Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Order of x, y, z rotation angles in OpenGL

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2012
    Posts
    18

    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_rotation*180.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.

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,183
    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.

  3. #3
    Member Regular Contributor
    Join Date
    Jun 2013
    Posts
    490
    Quote Originally Posted by Lee_Jennifer_82 View Post
    Does it imply that OpenGL follows that order or it depends on how the original matrix multiplication is done.
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •