I am having trouble with rotations ,
I am drawing a cube and want to rotate on two axis x and y.
glRotatef(fXrot,1,0,0);
glRotatef(fYrot,0,1,0); //cause gimbal lock like effects
If i rotate first on the x axis using glrotate , then what is the correct vector axis of rotation/angle such that the rotation on the yaxis always rotates the cube on the global yaxis? If i use the glRotatef(fYrot,0,1,0) in the manner posed above it rotates after the x axis rotation, spinning the cube in the local axis.
consider the example on a front facing cube with the following rotations:
glRotatef(90,1,0,0);
glRotatef(45,0,1,0);
this actually produces a diamond because the cube is first rot 90degress facing down, and then twisted in the local x axis 45 degrees twisting it into a diamond (see attached)
after doing:
glRotatef(90,1,0,0); now facing down
how would i get this equation (or the equivalent):
glRotatef(fRotX,v0,v1,v2);
so that after the sec desired result the cube will end up facedown but the left front corner facing the into the camera (see attached)