Advertisement Jump to content
Sign in to follow this  
KeLi

Get translated/rotated coordinates?

This topic is 4880 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!