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
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
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: