Quarternion question

Sorry about this but I cant find anything to answer my question in a search.

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).]

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

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?