Skip to main content
gamedev.net
🔒 Locked

Save current matrix?

Started by dpadam450 Aug 12, 2006 at 9:10 PM 0 replies 400+ views
Original Post
dpadam450
dpadam450
Just wondering if there is a way or function to get the current matrix. If so, what are the params/return type?
NBA2K, Madden, Maneater, Killing Floor, Sims 
Morpheus011
Morpheus011
indeed there is a way to do this, the function glGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix); will get you the values of the modelview matrix. glGetDoublev just takes the floating point values of the first parameter and stores it in the second parameter. In this case you will want to pass either an array of 16 floats (by passing the name of the array, in this case modelMatrix) or a pointer to a float where you will be storing the 16 values (remember these are 4x4 matrices).

You can use this for much more then just getting the current values of the matrix, and you can actually get the values of other OpenGL matrices as well. Check out the MSDN for a more detailed description (the entry for glGetDoublev also tells you what parameters are acceptable)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.