View Full Version : gluLookAt() - Matrix
Suppose the current modelview matrix is identity, When gluLookAt(a,b,c,d,e,f,g,h,i) is called, what modelview matrix will be ?
How the elements of this matrix correspond to the given parameters mathematically?
Thank you in advance.
I dont know the exact order of the operations(you know, U cross V != V cross U). But the basic idea is to use the three vectors to create a rotatio matrix. Upvector is the last vector, and front vector is the difference between the first two vectors.
Create a right-vector with front-vector cross up-vector.
Create a new upvector with front cross right.
Normalize front, right and upvectors.
You now have the three ortonormalized vectors to put in the rotation part of the matrix.
The exact procedure can be found in the MESA source.
Of course, the matrix is also translated according to the first vector.
10-11-2001, 03:59 AM
You can also check with the SGI OpenGL sample implementation, which has a source for GLU:
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.