Jump to content
  • Advertisement
Sign in to follow this  
KeLi

Get translated/rotated coordinates?

This topic is 4818 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

Hi! How can I retrieve the current coordinates after i've done a rotation or translation? If current coordinates is: 1.0f, 1.0f, 1.0f And when I rotate by 45 degrees in x-axis, I want to get the new coordinates. glPushMatrix(); glRotatef(45, 1.0f, 0.0f, 0.0f); glPopMatrix(); Sorry for my bad explanation. :)

Share this post


Link to post
Share on other sites
Advertisement
You could retrieve the current modelview matrix from OpenGL and multiply your point by that matrix to get the new point that OpenGL will draw.

Share this post


Link to post
Share on other sites
float matrix[16];
glGetFloatv(GL_MODELVIEW_MATRIX, matrix);

From there, you multiply this matrix by your point, you can find out how to do this online.

edit: Here's how to multiply a point by a matrix.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!