Reading back a matrix

Hi,
I’m currently moving my camera about by reading back the modelview matrix using glGetFloatv, and using the inverse of the matrix as the axes of motion. I’ve read, though, that reading info back from OpenGL is generally a Bad Thing for performance. So my question is, will it really take longer to read the matrix back once per frame than it will to calc the rotations myself? Thanks for any input.

Hi !

You should always try to keep a copy of this kind of things yuorself, it all depends on when you try to read the matrix, at the point in the code where you try to read the matrix, OpenGL must flush everything in the pipeline before it can execute the operation.

If you only do it one time per frame you might get away with it (if you are lucky), but I would recommend that you keep a backup copy of the matrix instead.

Mikael