Advertisement

glScalef and Ortho mode.

Started by May 02, 2003 03:33 AM
1 comment, last by Jumpman 21 years, 10 months ago
I''ve been trying to use glScalef() but is also seems to be scaling the origins of the object (sprite).. is there a way to scale a object via a gl command based on the ortho mode coordinates or is it best to pre-scale the object yourself in the code.. I guess this is comming from the fact that I want to make my stuff resolution independent.. being a 2d game (platform) I know I have n elements up and down so its easy to find to scale factor for the given resolution. for example I need 40 cells accross.. if the player is playing in 1024 res then each cell is 25 pixels, if they are playing in 800 then each cell is 20.. etc.. it would be nice to get openGL to scale things for me based on a screen to map ratio but I guess i can always calc the suff for myself.. any suggestions ?? Cheers Chris
Just pass a fixed width e.g. 800x600 as width, height to your glOrtho/gluOrtho call, then your viewport always as 800 units width and 600 units height no matter what the "real" dimensions of your window are. There is absolutely no need to manually scale.

c ya,
Tobias
Advertisement
thanks will give that a go. I guess you set up a fixed world size and render to that and it will will auto scale.

Cheers

This topic is closed to new replies.

Advertisement