OpenGL Matrix Transformations

(adapted from http://www.cs.uregina.ca/Links/class-info/405/WWW/Lab3/) Online documentation OpenGL glut

Highlights:

This page provides an introduction to Matrix Transformation

A. A Simplified View of the OpenGL Pipeline

B. Elementary Transformation

Translation:

Rotation:

Scaling

C. The Order of Transformations

D. Modeling Transformation v.s. Viewing Transformation

The gluLookAt() Function: define a viewing transformation

void gluLookAt( GLdouble eyex, GLdouble eyey, GLdouble eyez,
                 GLdouble centerx, GLdouble centery, GLdouble centerz,
                 GLdouble upx, GLdouble upy, GLdouble upz )
Parameters
  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.

Note that, these parameters are equivalent to the camera parameters specified in the textbook:

The gluLookAt() function makes it easy to move both the "from" and the "to" points in a linear manner. For example, if you need to pan along the wall of a building located away from the origin and aligned along no axes in particular, you could simply take the "to" point to be one corner of the building and calculating the "from" as a constant distance from the "to" point. To pan along the building, just vary the "to" point.

Mmodelview = Mviewing * Mmodeling

What this means is that your viewing transformations must be entered into the Modelview matrix before modeling transformations.

E. Manipulating the Matrix Directly

F. Viewport and Projection Transformations