So I managed to rotate my object using quaternion around its local coordinate system. This is the order of my code: -I created a unit quaternion -I got the transformation matrix -I used glMultMatrix to perform the rotation -I draw the object -I draw the frame which is the object frame When I set the value of the quaternion on : w=0.7, x=0, y=0.7, z=0, the object rotates around its Y axis, but also the X and Z axis rotate.
The problem I'm facing right now is that when I use glRotated to change the axes direction for example glRotated(-90.0f,0.0f,1.0f,0.0f) before drawing the frame so in this case we have x becomes z and z becomes -x, and then compile and set the value of the quaternion as follows: w=0.7, x=0.7,y=0,z=0, the object is supposed to rotate around the new x axis which direction was changed using glRotated but actually it rotates around the old x axis which has the same direction as the new z axis. It looks like it is rotating around the Z axis. Any idea how to fix that ? I wanted to rotate my object around this new frame but it keeps rotating around, I think, the old one. Also is it possible to make the object rotate with its local coordinate system around a fixed frame or a global coordinate system ?