PDA

View Full Version : Read Matrix values



Zadkiel
08-13-2000, 03:08 PM
Sorry if this should have been posted in the advanced forum, anyway heres my question. How do I read the values in an OpenGL matrix. I know how to use glLoadMatrix to use one of my own, I need to be able to save it after proformimg rotation, translation, etc http://www.opengl.org/discussion_boards/ubb/confused.gif
Thanks

Bob
08-14-2000, 03:03 AM
To read the values from a matrix in OpenGL, you can do like this.




GLfloat mvmatrix[16]; //modelview matrix is 16 elements long
GLfloat prmatrix[16]; //... as is the projec tion matrix

// now, get the matrices
glGetFloatv(GL_MODELVIEW_MATRIX, mvmatrix);
glGetFloatv(GL_PROJECTION_MATRIX, prmatrix);


Modelview is stored in mvmatrix, and projection is stored in prmatrix.