Get translated/rotated coordinates?

Started by
2 comments, last by Mercury 18 years, 7 months ago
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. :)
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.
How would I do this? I'm very n00b... :(
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.

This topic is closed to new replies.

Advertisement