Can someone explain what is happening in the example below:
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glRotatef(45,0,0,1);
DrawCube();
glTranslatef(4,0,0);
glRotatef(-45,0,0,1);
DrawCube();
glPopMatrix();
I am assuming that it will just rotate the square, shift it right 4 units, and then rotate it back to its original rotation. It seems too easy though, is there something I am missing?
Roughly-
This results in two cubes being drawn. The first is in the center, and rotated 45 degrees, and the second 4 units away on the rotated x-axis, and itself rotated -45 degrees.