PDA

View Full Version : Accessing matrices in opengl



farfnarr
06-04-2000, 01:56 PM
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

john
06-04-2000, 03:41 PM
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

Pauly
06-04-2000, 03:51 PM
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...)

Bob
06-05-2000, 02:56 AM
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.