Sign in to follow this  

Quaternion - OpenGL rotation

This topic is 4758 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites

This topic is 4758 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this