Is there a way to get access to the inverse modelview matrix via something like glGetFloatfv? I believe that the GL maintains a copy of this, so is it possible to get access to it?

The alternative is obviously to calculate it myself, but I’m doing this hundreds of times per frame, so I want to avoid that if possible.

glGet* might be pretty slow, too, because it might stall your GPU whereas stuff you do on your CPU is done in parallel. Granted, a 4x4 matrix inversion is not exactly free, either.

Alot of times, the best thing to do is to keep track of both matrix and inverse yourself. If most of your transforms are standard transforms (scale, rotate, translate) than it is relatively easy to compute the inverses and compose them.

If your matrices are made only form translation, rotation and uniform scaling, then you can get inverse very cheap. Just transponse 3x3 submatrix(rotation/scaling part) and negate last row(translation part)

Darkwing: good point, although your method is not strictly accurate; I can do it by transposing the rotation submatrix and then rotating the translation part by it.

I guess I don’t use non-uniform scaling very much, so it’ll probably work fine.