- create unit matrix
glLoadIdentity();
- rotate the matrix by
glRotatef(-119.718,-0.58064,-0.575698,-0.575699);
- get the matrix to CPU side code by
glGetDoublev
- compute the Euler angles from it using trigonometry in order you need
So the first 3 bullets are straightforward ...
double m[16];
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glRotatef(-119.718,-0.58064,-0.575698,-0.575699);
glGetDoublev(GL_MODELVIEW_MATRIX,m);
glPopMatrix();
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
and acos
are your friends) or google:
extracting euler angles from rotation matrix
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:
glRotatef(ax,1.0,0.0,0.0);
glRotatef(ay,0.0,1.0,0.0);
glRotatef(az,0.0,0.0,1.0);
And must be done in the same order as your Euler angles are ...