PDA

View Full Version : do they have the same implement order or not



victorswan
02-16-2002, 12:03 AM
when i want to implement some modeling transform, i want to know wether there are different implement order below:
the first method is using remember and go back way:
glPushMatrix();
glRotatef(72.0,0.0,0.0,1.0);
glTranslatef(3.0,0.0,0.0);
...
glPopMatrix();

the second is transforming directly:
glRotatef(72.0*i,0.0,0.0,1.0);
glTranslatef(3.0,0.0,0.0);
...
are they different or not?

satan
02-16-2002, 01:12 AM
i do not really get what you mean

in the first example you push the matrix to the stack and read it back after rotation meaning that it should be like it was before rotating

in the second you do not set the matrix back meaning that all following transformations are working on your rotated system

and of course once you rotate about 72 and once about 72*i

victorswan
02-16-2002, 05:31 AM
sorry, sometime, I wonder that transforming models directly may has a different implement order from transforming them using matrix stack, that means, if I transform a model directly:
glTranslate();
glRotate();
then the implement order is rotate first then translate
if I use matrix stack,
glPushMatrix();
glTranslate();
glRotate();
glPopMatrix();
the implement order is translate first then rotate.
I just suspect these two ways may have different implement order, but now I find I was wrong, the implement order should has nothing with using matrix stack or not.