@GClements Hello, I hope you’re doing very well.
Well, that did work perfectly.
2 months ago, I drew the object and then I drew the frame which is attached to it. I did exactly as you suggested and the object rotated around the axes of the new coordinate system ( the coordinate system which I changed the orientation of its axes).
Now, here is what I did.
I started drawing the standard coordinate system, then applied transformations( I changed the orientation of its axes using rotations) . This coordinate system is a fixed one.
glRotatef(180.0,0.0,1.0,0.0); // changing the orientation of its axes
glRotatef(-90.0,1.0,0.0,0.0); // again changing the orientation of its axes
DrawOrbitalFrame(); // drawing the fixed coordinate system
Then I drew the textured object using shaders.
My goal was to make the object rotate around the axes of the fixed coordinate system ( after changing its axes orientation) using quaternions of course.
However when I run my program and set the quaternion values as follows:
w=0.7, x=0.0, y=0.7, z=0.0, which is equivalent to a rotation of 90° around the y-axis.
The object rotates around the y-axis of the standard coordinate system ( the default OpenGL coordinate system) and not the y-axis of the fixed coordinate system I drew and changed its axes orientation.
So I thought about applying the same transformations as I did when drawing the fixed coordinate system at first, before drawing the object:
I did this:
localMatrix.rotate(180.0,0.0,1.0,0.0); // same rotation as the one applied to the coordinate system at first
localMatrix.rotate(-90.0,1.0,0.0,0.0); // same rotation as the one applied to the coordinate system at first
Then I drew the object
And that made the object rotate around the new axes of the coordinate system which is the result I’m looking for.
However, I still don’t get why it worked.
If I remove the transformations before drawing the object, apply rotation using a quaternion, the object goes back to rotating around the default OpenGL coordinate system which is the one represented in the picture below: