Skip to main content
gamedev.net
🔒 Locked

Does this code do anything?(Solved)

Started by Th0ughtCr1me Sep 21, 2006 at 8:36 PM 2 replies 1k views
Original Post
Th0ughtCr1me
Th0ughtCr1me
glPushMatrix(); glTranslatef(indexx+tempx,temph,indexz+tempz); glPopMatrix(); I mean, no matter what the variables are, shouldn't the push and pop mean that nothing is changed? [Edited by - Th0ughtCr1me on September 21, 2006 9:04:09 PM]
_______________ Play my Game at neonswarm.com
OCcsdude
OCcsdude
Based off of the little knowledge I have of OpenGL, I would say that that is irrelevant code.
Kalidor
Kalidor
Quote:
Original post by Th0ughtCr1me
glPushMatrix();
glTranslatef(indexx+tempx,temph,indexz+tempz);
glPopMatrix();

I mean, no matter what the variables are, shouldn't the push and pop mean that nothing is changed?
Well it still does what you tell it to, so it will do something.

Assuming the current matrix stack isn't full (so glPushMatrix doesn't produce a stack overflow error) it will push the matrix stack, multiply the current matrix by a translation matrix, and then pop the matrix stack, having no apparent effect except wasted time.

If the current matrix stack is full, then glPushMatrix will generate a stack overflow error and be ignored (the stack won't be pushed), then the current matrix will be translated, and then the current matrix stack will be popped, leaving the current matrix equal to whatever it was before the previous call to glPushMatrix before this code was executed.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.