Jump to content
  • Advertisement
Sign in to follow this  
SpacedOut

rotation matrix question with OpenGL

This topic is 4333 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 want to be able to move around in OpenGL with respect to the direction I'm currently facing. I know I can get the current matrix with: GLfloat matrix[16]; glGetFLoatv(GL_MODELVIEW_MATRIX, matrix); I think this has something to do with an inertial coordinates to world coordinates conversion, but I've also been considering trying to implement this by pushing a matrix onto the stack. Any help appreciated.

Share this post


Link to post
Share on other sites
Advertisement
In OpenGL it's generally best to compute the orientation matrix for your object (and thus the direction vectors for movement) yourself.

If however you want to use the query method, you have to make sure that the OpenGL modelview matrix contains only the desired transform, and then extract the direction vectors from the rows (0, 4, 8) or columns (0, 1, 2) as appropriate. If the modelview matrix currently represents the view matrix only, then the basis vectors are in the rows (generally speaking), but if you've, say, set up a temporary model transform instead, they're in the columns.

Again though, for various reasons it's really best to compute these values yourself.

Share this post


Link to post
Share on other sites
makes sense. Thanks, I've got another question...

If I'm storing orientation with a quaternion, is there a way to get the view vector and up vector?

Share this post


Link to post
Share on other sites
http://www.gamedev.net/reference/articles/article1997.asp

has infor about quats and inputing it into the glulookat... which has an up vector!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!