View Full Version : Accessing matrices in opengl
06-04-2000, 02: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,
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*);
06-04-2000, 04: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...)
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.