inverse modelview matrix

I’m sure this has been posted before:

anyone know a quick way to get the inverse modelview matrix?

is the only way to do a glGetDoublev() and then run the modelview through my own function to retrieve the inverse?

thanks.

If you are doing something like billboarding and you have only isotropic scaling, you can cheat by looking at the transpose of the MVM. Check out this: http://www.lighthouse3d.com/opengl/billboarding/index.php3?billInt

It’s not quite as simple as just the transpose; that only covers rotation. For a rotation-and-translation MVM you need to:

a) transpose the rotational basis; that’s the upper-left 3x3 submatrix

b) negate the translation vector; the first 3 numbers in the 4th row (or column, depending on your notation)

c) multiply the negated vector by the transposed basis

Still a lot simpler than a full inverse function for an arbitrary 4x4 matrix. For most apps, you’ll never need such a thing.

However, if you really need the inverse, here is some info, how to do that (it´s very easy, in fact):

Link

Jan.