Hi!
I want to be able to rotate a sphere about the “world axis” at all times. But when I rotate about the x-axis the local axis for the sphere will change and then when I want to rotate about the z-axis I want to be able to do that rotation as if I never did the first one… Sorry about my bad english.
I think I might have been a bit unclear in my first post… I want the sphere to stay i the same place and rotate it about axis parallel to the world’s axis. Pherhaps this makes it clearer.
I would still be happy for any information on this!
glRotate … rotates your matrix around a build matrix, this produces local rotation! to get global rotation you have to multiply the constructed matrix with your object matrix ( opengl: matrix* rotationm.= result, youneed: rotationm.* matrix=result)
the problem is that reading states/matrices is slow, so you have to calc all matrixopps by yourself and load the result into opengl via glLoadMatrix …
The first piece will rotate the object one degree about the vector (xrot, 0, zrot), while the second piece will rotate the object first zrot degrees about the Z-axis, and then xrot degrees about the X-axis. Two completely different operations.