glPushMatrix() and glPopMatrix();
Sup All,
I''ve just started OpenGL from the AWESOME OpenGL Game Programming book. I have a question about the glPush and Pop functions. It is unclear to me what it exactly does. To my understanding it just resets the object creation position which was changed by glTranslatef(...) to the previous position. However, in chapter 5 in the robot example, removing glPushMatrix() from the DrawArm function has no effect.
Correct me if I''m wrong and please try to explain my observation.
Thanks,
mAdMaLuDaWg
-----------------------------"Q: How many Microsoft engineers does it take to change a light bulb?A: None. Bill Gates will just redefine Darkness(TM) as the new industry standard. "~wUn LoVe tO aLl ThE mAlUs OuT tHeRe!~
glPushMatrix() puts the current object creation position on top of the stack so you can "save it for later". Say that you need to glTranslate the drawing position to draw something on the side of the screen, then when you want to move back you don''t know where you came from, right? If you use glPushMatrix() before you do a glTranslate, then you can easily retreave your old drawing position again with the pop function. Do you know what a stack is?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement