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");
cm.setFrameFullscreenQuad()
cm.setUvRange(self.tex)
card = NodePath(cm.generate())
card.reparentTo(render2d)
card.setTexture(self.tex)
card.setTexScale(TextureStage.getDefault(), self.tex.getTexScale())
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.
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.