Vizard 7 » Tutorials & Examples » Example scripts » Multimedia » Video texture
7.5

Video texture

\examples\multimedia\videotex.py

This script demonstrates how to use video textures. This example displays an MPEG video file on the faces of a box.

"""
This script demonstrates how to use video textures.
This example displays an mpeg video file on the faces of a box.
"""
import viz
import vizact

viz.setMultiSample(4)
viz.fov(60)
viz.go()

import vizinfo
vizinfo.InfoPanel()

# Add a box object and spin it
import vizshape
box = vizshape.addBox()
box.setPosition([0,1.5,5])
box.addAction(vizact.spin(0,1,0,90))

# Add, start, and loop the videow
video = viz.addVideo('mona.mpg')
video.play()
video.loop()

# Apply the video to the object
box.texture(video)

# Add a ground surface
ground = viz.addChild('ground.osgb')

# Change the background clear color to a shade of blue
viz.clearcolor(viz.SLATE)