Cardmaker dot frame

Hi all. I’m getting my feet wet in Panda3d and I’m trying to figure out how it does certain things.

I’m trying to figure out how to use CardMaker.setFrame … does this card go by the normal panda3d coordiante system, or does it go by a a hard texture size?

I ask because I’m trying to create a card that plays a movie on it. I can do so, but the movie looks a little squished. It is high def, 1920 x 1200 or something similar, but I can’t figure out how to translate that out of the square that cardmaker creates.

Anyone have any idea how I might do this?

Let’s say the panda window is 800x600, and the movie is 1920x1200. Obviously, the movie is too big to fit in the window. You need to scale down the movie until it fits in both dimensions.

To scale it down horizontally:

800 / 1920 = 0.41
600 / 1200 = 0.50

The smaller one is the 0.41. So you need to scale the movie to 0.41 times its original resolution to make it fill the screen. The final resolution of the movie will be:

1920 * 0.41 = 800
1200 * 0.41 = 500

So after scaling, the movie will be 800x500, in an 800x600 window. Next, you need that in screen coordinates.

Movie res X / window res X = 800 / 800 = 1.00
Movie res Y / window res Y = 500 / 600 = 0.83

So the setFrame is (-1.00, 1.00, -0.83, 0.83)

Ah hah! That’s exactly what I needed. Thanks!

I’ve got to say I love this project. I was trying to get this to work in OGRE last week and I was making no headway. And today I just sat down and made major headway in Panda.