View Full Version : glPush() and glPop()

Alexander Dong Back Kim
09-20-2005, 04:41 PM
Hi all

I've just studied about those command...
According to the Red book, I guess they are related with some matrix calculation stuff for transformation of objects in the OpenGL view. However, I didn't understand what exactly they do or they are for.

Can anyone explain for me, I will appriciate that.

Alex D.B., Kim

09-20-2005, 05:05 PM

I can't help you on what exactly they do, but I can try my best at teaching you how to use them.

glPushMatrix(); and glPopMatrix(); are used when you want to transform an object, such as scaling, translating, or rotating. If you do not use the commands then your object will not be transformed as you would like. glPushMatrix(); is placed before the code to transform the object and glPopMatrix(); is placed after the code to draw the object.

I hope this was of help to you

09-20-2005, 09:48 PM
you need them if you want to translate an rotate geometry independantly from each other. glpushmatrix() pushes a copy of the current matrix onto the stack which you can then edit. glpopmatrix() pops this matrix then so the previous matrix is restored:


Alexander Dong Back Kim
09-21-2005, 05:41 PM
Thanks guys