Advertisement Jump to content


This topic is now archived and is closed to further replies.


Retrieving the top x, y, z values from the matrix stack.

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

How would I go about getting the x, y, z values from the top matrix on the modelview matrix stack? Basically what I'm looking to do is make a few transformations, then grab those values and use them to move my camera around (using gluLookAt(...)). That way I don't have to recreate routines to do matrix multiplication. If there's a better way to achieve what I'm trying to do, I'm open for suggestions. Otherwise, here's an example of what I'm getting at; glPushMatrix(); glLoadIdentity(); glTranslatef(...); glRotatef(...); float vect3[3] = get_xyz_values_from_matrix_stack(); gluLookAt(vect3[0], vect3[1], vect3[2], ...); glPopMatrix(); EDIT: Oh ya.. thanks in advance for any and all help. [edited by - wyrd on June 1, 2004 12:00:41 AM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!