why whole video is not display in the media player sample


I am a newbie to Panda3D, so perhaps my question is stupid and not posted at the right place.

I need to play a fullscreen video so I have take a look at the sample “media player” and I encounter a problem : my video is cropped.

So I have checked with the sample and there is the same problem.

To be sure the video as the same aspect ratio as the video I resize the video from the sample (with the two pandas) to 800x600 as my window is 800x600 too. And the video with the two pandas is cropped too.

Any idea why ?

The sample is pretty simple

# Load the texture. We could use loader.loadTexture for this,
# but we want to make sure we get a MovieTexture, since it
# implements synchronizeTo.
self.tex = MovieTexture("name")
assert self.tex.read(MEDIAFILE), "Failed to load video!"
# Set up a fullscreen card to set the video texture on.
cm = CardMaker("My Fullscreen Card");
card = NodePath(cm.generate())
card.setTexScale(TextureStage.getDefault(), self.tex.getTexScale())

For me it can come from the line



card.setTexScale(TextureStage.getDefault(), self.tex.getTexScale())

what is the solution ? Can it be related to a problem of “power of two” (as 800x600 is not power of two) ?

ok … so the problem seems to come from a “power of two problem” as if a getPadXSize/getPadYSize of self.text there is padding.

so I have to play with UVs.

I think you should do either the setUvRange() call, or the setTexScale() call, but not both. Either one of these is designed to compensate for the power-of-two scaling; and if you do them both, you have overcompensated.


ok thanks … I’ll try to try it tonigh.

another question: it seems the behavior is not the same for a file loaded as a texture or as a movie. it seems that if I load a file as a texture the resolution is not modified (keeped as 800x600 for exemple) but if it is a movie the resolution is changed to match power of two. Am I right ? Or do I missed something ?



If you load a file, Panda will scale its pixels at load time to the nearest power of two, so your 800x600 texture actually becomes a 512x512 texture in memory. That’s why the file texture fills out its UV’s completely.

For a movie, this isn’t practical. So instead of attempting to scale the texture, Panda has to require you to adjust the UV’s instead.


thank your very much.

In fact as my “project” is only a demo and I know the PC which is target I simply set ‘textures-power-2’ to ‘none’, for now.

thanks again.