Tao.OpenGl SDK Documentation

Glu.gluLookAt Method 

Defines a viewing transformation.

[Visual Basic]
Public Shared Sub gluLookAt( _
   ByVal eyeX As Double, _
   ByVal eyeY As Double, _
   ByVal eyeZ As Double, _
   ByVal centerX As Double, _
   ByVal centerY As Double, _
   ByVal centerZ As Double, _
   ByVal upX As Double, _
   ByVal upY As Double, _
   ByVal upZ As Double _
)
[C#]
public static void gluLookAt(
   double eyeX,
   double eyeY,
   double eyeZ,
   double centerX,
   double centerY,
   double centerZ,
   double upX,
   double upY,
   double upZ
);

Parameters

eyeX
The x axis position of the eye point.
eyeY
The y axis position of the eye point.
eyeZ
The z axis position of the eye point.
centerX
The x axis position of the reference point.
centerY
The y axis position of the reference point.
centerZ
The z axis position of the reference point.
upX
The x axis direction of the up vector.
upY
The y axis direction of the up vector.
upZ
The z axis direction of the up vector.

Remarks

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.

See Also

Glu Class | Tao.OpenGl Namespace | glFrustum | gluPerspective