# The Industry's Foundation for High Performance Graphics

1. ## Quarternion question

Right. I've read the FAQs on quaternions and want to know how to implement them in OpenGL. Im trying to do a rubixs cube and am trying to bypass the problem of gimbal lock. The rotation angles are stored as eulers floats.

Have I got this right for converting euler angles into quaternions into a rotation matrix:

1. Get Euler angles.
2. Convert the three angles into a single quaternion.
3. Convert the quaternion to a rotational matrix.
4. glMultMatrix the rotational matrix when drawing object.

[This message has been edited by blood.angel (edited 01-31-2002).]

2. ## Re: Quarternion question

If you're starting with Euler angles and want to end up with a matrix, you have no need of quaternions...you can convert your angles directly into a rotation matrix.

There is nothing inherently special about quaternions....they are just another representation of the rotation group. Do a google search for quaternion FAQ and read up on them. It should also have the formulas you're looking for.

-- Zeno

3. ## Re: Quarternion question

Yeah I have looked at the various FAQs about the place.

Maybe I havnt said what I wanted right.
The cube Im drawing is based at (0,0,0) and rotated in the x,y,z axis about it.
I want it so the cube is rotated in the x axis of the viewer and not the xaxis of the cube itself (as the xaxis of the cube is rotated if the y or z axis is rotated prior).

And when looking through these boards I saw that quaternions were the suggested solution. Are they?

#### Posting Permissions

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