Previous topic TOC

Use video textures

Next topic

Video texture Besides normal textures, you can use textures based on video-clips to decorate objects. A video texture is created analogue to the normal texture, and supports an extra method for playing and synchronizing the video-clip. Example:
factory.useDegrees = true;
var vidTex = VideoTexture("your video.avi"); // load the video file
   
var b = Box(100,100,100);  // create a box
 
// and decorate the box with the video texture 
b.useTexture( vidTex ); 

while(true)
{ 
   //  play video forward .1 seconds
   vidTex.play(VT_NEXT, .1);	
   
   // do some other work
   b.rotate(0,2,0);
   
   // synchronize: wait till the scene is rendered 
   WaitFrame();
};
In this example, the video clip is forwarded for 0.1 seconds and the result is rendered on each side of the box. By stepping thru the clip with defined interval times, the video can be synchronized with other parts of the animation or simulation.