# Order of x, y, z rotation angles in OpenGL

I have extracted the three rotation angles from a rotation matrix. Now if an object is multiplied by the rotation matrix or the rotation angles, both should give the same result. I followed the following order of rotation and I get the correct result, i.e. multiplying the object with the rotation matrix gives the same result:

glRotatef(y_rotation180.0)/PI, 0.0, 1.0, 0.0);
glRotatef(z_rotation
180.0)/PI, 0.0, 0.0, 1.0);
glRotatef(x_rotation*180.0)/PI, 1.0, 0.0, 0.0);

Does it imply that OpenGL follows that order or it depends on how the original matrix multiplication is done.

The latter. There’s no right way to build a rotation transform (or right order, if you’re going to use euler angles). In fact you may build it without any euler angles involved at all. For instance, using orthonormal basis vectors, or from a quaternion, etc.

It implies that the function which “extracts” the angles from a matrix does so assuming that order.

If you used a different order, you’d need a different extraction function.