• Advertisement
Sign in to follow this  

Finding True x,y,z after transforms.

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

Hello peeps, I am wondering, after a set of transforms (glRotatef, glTranslatef, etc), is there a standard way to ask what the 'true' {x,y,z} value you are working with is? I am asking because I have a known {x,y,z} camera location and wish to rotate a bitmap to orient based off the camera from an unknown location after a series of transforms (NeHe Tutorial 09 + gluLookAt). Any help would be appreicated, Nee.

Share this post


Link to post
Share on other sites
Advertisement
If I remember correctly, if you know what transformations you did, then you can. You apply the inverse matrices of each of the transformations over your final matrix in the inverse order you applied the transforms.

Share this post


Link to post
Share on other sites
AFAIK you can't get the transformed positions of vertices you passed to OpenGL.

What you can do is get the current modelview matrix from OpenGL (glGet(GL_MODELVIEW_MATRIX, _16_component_float_array_for_the_matrix)). Then do the transform yourself (billboard.position * matrix) to get the transformed position.

If you don't use any scaling you could also read the billboard's center position relative to the camera directly from the modelviewmatrix (components 14, 24, 34). Since the modelview matrix basically transforms the world to camera space, every vector transformed by the modelview matrix is also in camera space.

Share this post


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

  • Advertisement