Original Post
🔒 Locked
Matrix functions?
Advertisement
glPushMatrix and glPopMatrix are responsible for saving and restoring the transformation matrix, respectively. They work the same way a stack works.
glPushMatrix() // save current state of transformation matrix
... // apply some other transformations to the matrix
glPopMatrix() // restore matrix to the state it was when glPushMatrix() was issued
It would help to google for the sake of research before posting questions here
glPushMatrix() // save current state of transformation matrix
... // apply some other transformations to the matrix
glPopMatrix() // restore matrix to the state it was when glPushMatrix() was issued
It would help to google for the sake of research before posting questions here
I did do some searching before I posted, but everything I found was either unclear or I didn't understand it. I thought it might be what it said, but wanted to make sure anyway. So basically it's just a way of changing things around without having to change the view?
[edited by - Kaezin on January 11, 2003 5:11:44 PM]
[edited by - Kaezin on January 11, 2003 5:11:44 PM]
yes, and you can do hierarchical things with it also: e.g. you have got a car:
do the view things
glPushMatrix();
rotate&move it to its position & orientation
draw car body
for each wheel:
-glPushMatrix();
-move wheel to proper postion & rotate to proper orientation relative to the car
-draw wheel
-glPopMatrix();
glPopMatrix();
GA
do the view things
glPushMatrix();
rotate&move it to its position & orientation
draw car body
for each wheel:
-glPushMatrix();
-move wheel to proper postion & rotate to proper orientation relative to the car
-draw wheel
-glPopMatrix();
glPopMatrix();
GA
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement