I want create a global rotation matrix so that I can view the world from any angle by dragging the mouse. It is OK to just rotate about the origin (my world is a clipped unit cube centred on the origin and I just want to spin it to look at it from any direction).
I am almost there, but it doesn’t quite work. My code is
Thanks for posting this, but I am not sure it does what I want. If I understand it correctly the animation rotates automatically around z, and key presses rotate it around x and y.
(I am actually working in Java with JOGL, so I am not set up to easily compile c++, although the OpenGL interface is near identical)
What I need, I think, is for mouse X to always rotate around the Y axis of the camera coords, and mouse Y to always rotate around the X axis of the camera coords. And of course the mouse can move X and Y at once.
Perhaps I need to create some kind of accumulated rotation matrix or something?
Some people call that ‘Screen Space’ rotations.
I have another demo that does that - actually it does screen and body space rotations.
The rotations are done with keyboard keys. You’ll have to put in the mouse stuff. The source is at -
[Screen & Object Space Rotations](http://www.mfwweb.com/OpenGL/Special_Rotations/)