in raw openGL, when you rotate something, there's a matrix multiplication going on. if you rotate twice, the results can be different, because the multiplication isn't commutative, means A*B is NOT equal to B*A. it looks like, the rotation axes have been rotated as well with the first rotation (or second one, dunno
- cpp Code: Select all
GLfloat M[16];
switch (key)
{
case GLUT_KEY_LEFT:
glGetFloatv(GL_MODELVIEW_MATRIX , M );
glLoadIdentity();
glRotatef(angle,0,0,1);
glMultMatrixf(M);
break;
...
the matrix after the first rotation needs to be saved and the second rotation done to the original picture, then they have to be multiplied, so you have always A*B and never B*A ( i didn't get it, thats just what my teacher said...
but if you're looking onto an area from above, you might wanna remove the matrix storage in the left/right directions, that might look more natural.
