View Full Version : inverse modelview matrix
Aeluned
10-13-2004, 09:00 AM
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.
endash
10-15-2004, 02:50 PM
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
MikeC
10-16-2004, 08:38 AM
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 (http://skal.planet-d.net/demo/matrixfaq.htm#Q21)
Jan.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.