View Full Version : Angles...

09-06-2000, 07:28 PM
After performing translations and rotates how would you get the currect modelview matrix vector... like the vector it is looking towards...
it would be greatly helpfull if someone can give me some insight or webpages/etc.. about this topic.


09-06-2000, 10:21 PM
Well, well. First start by getting back the modelview matrix with a glGetfv(GL_MODELVIEW_MATRIX, lMatrix), lMatrix being an array of 16 floats. The values of the matrix are in column major order, that is the first four floats correspond to the first column of the matrix, etc... I suppose what you want is the -Z vector because the default look at direction in OpenGL is (0, 0, -1). So you just need to get -lMatrix[8], -lMatrix[9] and -lMatrix[10].
Hope that helps you. By the way it may be faster to compute the look at direction transformations yourself instead of asking OpenGL for the resulting matrix.