Defines a viewing transformation.
gluLookAt creates a viewing matrix derived from an eye point, a reference point indicating the center of the scene, and an UP vector.
The matrix maps the reference point to the negative z axis and the eye point to the origin. When a typical projection matrix is used, the center of the scene therefore maps to the center of the viewport. Similarly, the direction described by the UP vector projected onto the viewing plane is mapped to the positive y axis so that it points upward in the viewport. The UP vector must not be parallel to the line of sight from the eye point to the reference point.
The matrix generated by gluLookAt postmultiplies the current matrix.
The matrix M generated by the OpenGL could be computed as follows:
Let E be the 3d column vector (eyeX, eyeY, eyeZ). Let C be the 3d column vector (centerX, centerY, centerZ). Let U be the 3d column vector (upX, upY, upZ). Compute L = C - E. Normalize L. Compute S = L x U. Normalize S. Compute U' = S x L.
M is the matrix whose columns are, in order:
(S, 0), (U', 0), (-L, 0), (-E, 1) (all column vectors)
Note: This matrix is defined for use in systems where the the modelling coordinate vector is a column vector and is multiplied on the left by the matrices. If you prefer a row vector which gets multiplied by matrices to its right, then use the transpose of this matrix M.
Note: It is necessary that the UP vector NOT be parallel to the line connecting the center point with the eye point.
Glu Class | Tao.OpenGl Namespace | glFrustum | gluPerspective