AVI Textures

Could somebody please point me to the direction of how to setup looping avi textures because I intend to play movies on a 3D television…

Just load the avi as if it were an ordinary image:

tex = loader.loadTexture('mymovie.avi')
smiley.setTexture(tex, 1)

David

Hi, thanx and I have got it to load since but the problem is that for certain avi files it plays only on a portion of the plane I am texturing it with (The television screen) is there any way to force panda to texture the entire plane? at present it textures about 1/3 of the plane and leaves the rest black…

Most hardware can only render textures that are powers of 2 in each dimension (for instance, 128, 256, 512, or 1024). If your movie has dimensions that are not a power of 2, then by default Panda will create a texture image that is the next larger power of 2, and put your movie in the upper-left corner.

So, you have three choices.

(1) Make sure your movies are all powers of 2 dimensions.

(2) Put the following in your Config.prc file:


textures-power-2 none

This will turn off the insistence on having a power-of-2 texture. If your movie is 640x480 pixels wide, Panda will create a texture that is 640x480 pixels wide to play it in. Note that this will work perfectly on some graphics cards, will work v-e-r-y slowly on other graphics cards, and not at all on other graphics cards.

(3) Remap the UV’s on your object so that they reflect the part of the texture that actually contains the movie. For instance, if your movie is 640x480 pixels, Panda will create a texture that is 1024x512 pixels (the next larger power of 2 in each dimension). Thus, the U part of the texture is in the first 640/1024 = 0.625 portion, and the V part is in the first 480/512 = 0.9375 portion. So if your UV range goes from (0, 0) to (0.625, 0.9375), you will completely fill the object with your movie, and there will be no black space. You can get these ratios at runtime with tex.getTexScale().

David