Order of Transform
OpenGL does a post-order transform. THis means that if you specify something like
The following code
glRotatef(45, 0, 0, 1);The
glTranslatef(20,0,0);
glBegin(GL_QUADS);
glVertex3f(-60,0,-10);
glVertex3f(60,0,-10);
glVertex3f(60,60,-10);
glVertex3f(-60,60,-10);
//glVertex3f(-10,0,0);
glEnd();
Quads will be translated and then followed by rotation. The following code
glTranslatef(20,0,0);would result in the
glRotatef(45, 0, 0, 1);
glBegin(GL_QUADS);
glVertex3f(-60,0,-10);
glVertex3f(60,0,-10);
glVertex3f(60,60,-10);
glVertex3f(-60,60,-10);
glEnd();
glPopMatrix();
Quad being rotated first before being translated.

0 Comments:
Post a Comment
<< Home