Defines a viewing transformation.
OpenGL C bindings library: libGL.a
void gluLookAt(GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ, GLdouble centerX, GLdouble centerY, GLdouble centerZ, GLdouble upX, GLdouble upY, GLdouble upZ)
The gluLookAt subroutine multiplies the top matrix of the current matrix stack with a matrix M (computed below), whose effect is to place the eye point at the origin, the center point along the negative z axis, and the up vector somewhere in the YZ plane, above the z axis. This is done through pure rotation and translation, preserving all distance metrics.
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.
eyeX, eyeY, eyeZ | Specifies the position of the eye point. |
centerX, centerY, centerZ | Specifies the position of the reference point. |
upX, upY, upZ | Specifies the direction of the up vector. |
/usr/include/GL/gl.h | Contains C language constraints, variable type definitions, and ANSI function prototypes for OpenGL. |
The glFrustum subroutine, gluPerspective subroutine.