Quaternion - OpenGL rotation

Started by
2 comments, last by Dmytry 19 years, 4 months ago
I have spent the last three days trying to solve this but no luck on my end. I convert from quaternion to matrix and apply the matrix to OpenGL. The rotation works fine. The thing is that the world it self rotates on the screen. Not the camera. Any advice will be appreciated.
Advertisement
Thats because you are probably multiplying your matrix with the modelview matrix for your world, hence causing the entire world to be rotated.

What you need is to multiply your matrix against the matrix for the camera.
I thought of that but, OpenGL doesn't have a camera matrix, only perspective, texture, and model. I'm thinking that I must perform some type of equation to the quaternion or the matrix itself before applying it to OpenGL. The thing is, I can't find out what it is!
how you can tell if it's world is rotating around camera, or camera rotates?[grin][lol]

i guess, your translation is incorrect, i.e. you are doing something like
glLoadMatrix(matrix_you_got_from_quat);
glTranslate(minus_camera_position);

Instead, you should translate first, and glMultMatrix then. Or the best, put position into last column of your matrix, and then load it...

This topic is closed to new replies.

Advertisement