PDA

View Full Version : Switching to and from orthogonal projection



08-21-2003, 06:16 AM
I'm currently working on an openGL project in which I have implemented a console...

I use orthogonal projection when rendering the console so that i can accurately place text and draw the console on a per pixel basis, but I dont use orthog when rendering my game world. So each frame (if the console is up) I need to switch to orthogonal projection to render it then switch back to render the world, I'd like to know the quickest way of doing so.

Currently I use quite a few lines of code to switch OUT of orthog (to 'perspective' projection?) because I set up the view area and fov all over again, which I'm sure is unnecessary.

Thanks.

chowe6685
08-21-2003, 06:22 AM
the usual strategy is to use glPushMatrix() and glPopMatrix to store the perspective projection while you render in ortho. At least thats what I usually do. I doubt however that the switch between ortho and perspective is likely to be a bottleneck in your program.

08-21-2003, 06:29 AM
I think I tried push & pop matrix but something went all funny with the perspective mode, maybe I just need to experiment more