Computing inverse of model view matrix

Hello everyone,

Is there anyway we can get the inverse matrix of the model view matrix in OpenGL efficiently? Of course, we could get that matrix by glGetDoublev(GL_MODELVIEW_MATRIX,m) and then compute the inverse of m manually, but it’s way too long since internally, I think, OpenGL must use the inverse to transform normal vectors.

Any help would be greatly appreciated.


That is the only way to do it generally. However, if you happen to know that the model view matrix is only a concatenation of rotation matrices, then computing the inverse is trivial, its just the transposition.