Accessing matrices in opengl

I’d like to be able to store a matrix produced by transformations, but I can’t seem to find a command that will let me. I’m aware of the matrix stacks, but I want to be able to store them permanently and for many different objects. I’d rather not have to write my own matrix library to do all the transformations myself when openGL’s is already done. Is there anyway to access the matrices? Thanks,
Chris

Yep. Look at glGetDoublev(GL_MODELVIEW_MATRIX, GLdouble*);
It’ll return the top of the modelview matrix stack. Now, if you want to restore that matrix, just do a glLoadMatrix(GLdouble*);

cheers,
John

Getting data back from OpenGL is pretty slow - if you’re hellbent on speed it might be better calculating the matrices yourself. At least then you can use the data for other stuff (collision detection, culling, LOD, blah, blah…)

I really don’t think that getting values from OpenGL is as slow as getting framebuffer information, since there is no need to flush the pipeline (I dont know how it is on hardware T&L though). But yeah, you are right Pauly, if you are REALLY in need of speed, you should do it on your own.