• Advertisement
Sign in to follow this  

Does this code do anything?(Solved)

This topic is 4170 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement