![]() |
|
OpenGL and Gimbal Lock |
Myrdos
Member #1,772
December 2001
|
In the OpenGL Red Book, they have the following example for changing the viewing angle: 1glRotated(roll, 0.0, 0.0, 1.0);
2glRotated(pitch, 0.0, 1.0, 0.0);
3glRotated(heading, 1.0, 0.0, 0.0);
However, doesn't applying successive rotations like this introduce gimbal lock? Is there a way to combine the roll, pitch and yaw into a single operation? Or is that necessary? __________________________________________________ |
SiegeLord
Member #7,827
October 2006
![]() |
Create a rotation matrix from a quaternion, and load it in with glMultMatrix. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
Myrdos
Member #1,772
December 2001
|
Awesome! That's just what I was looking for. __________________________________________________ |
Tobias Dammers
Member #2,604
August 2002
![]() |
SiegeLord said: Create a rotation matrix from a quaternion, and load it in with glMultMatrix. Alternatively, store rotations as pairs of axis and angles, and use a single call to glRotatef(). Such an axis/angle pair can also be constructed from a quaternion with little effort. --- |
Myrdos
Member #1,772
December 2001
|
Tobias Dammers said: Alternatively, store rotations as pairs of axis and angles, and use a single call to glRotatef(). Such an axis/angle pair can also be constructed from a quaternion with little effort. I wonder: If I'm using quaternions for interpolation anyways, does it matter if I convert the quaternion to euler angles or to axis/angle pairs when rotating? __________________________________________________ |
|