# Thread: rotate an object in Opengl

1. ## rotate an object in Opengl

Hi, i'm learning opengl through a little app and now ive bumped into the 3d rotational problem.

I store data for my object both the Rotation matrix and the quaternion. I want to visualize it and i tried to use glrotatef() with a quaternion_toAxisAngle() function but it doesnt quite work since glrotatef() accepts angles from 0 to 360 degrees and my quaternion_toAxisAngle() delivers an angle between -180 and 180 so when it starts to rotate around the x axis it does well between 0 and 180 degrees but then it stops rotating and gets stuck at 180 degrees. This happens when i apply a torque in the x axis.

I think i cannot modify my quaternion_toAxisAngle() function to match the angle requirements so what are the alternatives?
How can i do in order to have the object rotating 360 degrees?

2. -180 to 180 is 360 degrees. The function is using values relative to PI instead of 2 * PI. I don't see the problem.

3. You um don't actually rotate objects in OpenGL you rotate your projection matrix...

4. -180 to 180 is 360 degrees. The function is using values relative to PI instead of 2 * PI. I don't see the problem.
the rotation must be 360 degrees clockwise o counterclockwise, not just only 180

5. You um don't actually rotate objects in OpenGL you rotate your projection matrix...
I thought the vertex data was modified by the model view matrix?

To the question: Why not write a converter which maps 0..180 to the corresponding value and -180..-1 to 180..359? But I think this is unneccessary.

6. Ok, solved!!, the strange rotation i was having made me think there was somthing with the angles range but there wasn't.

The error was i was rotating a vector by a quaternion when what i really wanted was to perform a multiplication between a quaternion and another quaternion from a vector:

v2 = Q *v*Q'