PDA

View Full Version : GL_PROJECTION stack



kosta_m
08-18-2002, 12:10 AM
Could anybody give me an example
for using GL_PROJECTION stack?
I mean, why should one use the history
of PROJECTION matrices instead of
single PROJECTION matrix.
Thanks.

Bob
08-18-2002, 02:50 AM
If you, for a short while, want to use a different projection, the projection stack is usefull.

Say, for example, you render your scene in perspective projection. When the scene is drawn, you want to draw some text ontop of everything. Push the projection matrix stack, set a new projection matrix, preferably an orthographic with 1:1 window coordinate to viewport coordinate mapping, and draw yuor text. When done, pop the stack and you have your old projection matrix back. The text drawing function does not have to know about the old projection matrix to recreate it afterwards.