I have the function glRotatef with these parameters.
glRotatef(-119.718,-0.58064,-0.575698,-0.575699);
If I do this...
glRotatef(-119.718,-0.58064,0.0,0.0);
glRotatef(-119.718,0.0,-0.575698,0.0);
glRotatef(-119.718,0.0,0.0,-0.575699);
I do not get the same rotation as using the above. So, how do I get the rotation of each element (x, y, z) from this?
glRotatef(-119.718,-0.58064,-0.575698,-0.575699);
glLoadIdentity();
glRotatef(-119.718,-0.58064,-0.575698,-0.575699);
glGetDoublev
So the first 3 bullets are straightforward ...
the last bullet depends on your Euler angles order and coordinate system notations and its a pure math... So either derive the equations your self (
atan2
andacos
are your friends) or google:And find a hit matching your order... To implement it you also need to understand the stuff so see my:
Also from the OP I got the feeling you do not understand how
glRotate
works. In a nutshell it rotates around point(0,0,0)
and arbitrary 3D vector as axis. See Rodrigues_rotation_formula in the previous link but its doable also by exploiting cross and dot product and using axis aligned rotation.Now to get back to your question after you obtain the Euler angles (assuming order
ax,ay,az
) then the rotation itself would look like this:And must be done in the same order as your Euler angles are ...