next up previous contents index
Next: 2.10.1 Controlling the Viewport Up: 2 OpenGL Operation Previous: 2.9 Rectangles

2.10 Coordinate Transformations

 

Vertices, normals, and texture coordinates are transformed before their coordinates are used to produce an image in the framebuffer. We begin with a description of how vertex coordinates are transformed and how this transformation is controlled.

Figure 2.6 diagrams the sequence of transformations that are applied to vertices. The vertex coordinates that are presented to the GL are termed object coordinates. The model-view matrix is applied to these coordinates to yield eye coordinates. Then another matrix, called the projection matrix, is applied to eye coordinates to yield clip coordinates. A perspective division is carried out on clip coordinates to yield normalized device coordinates. A final viewport transformation is applied to convert these coordinates into window coordinates.

  
Figure 2.6: Vertex transformation sequence.

Object coordinates, eye coordinates, and clip coordinates are four-dimensional, consisting of x, y, z, and w coordinates (in that order). The model-view and perspective matrices are thus .

If a vertex in object coordinates is given by and the model-view matrix is M, then the vertex's eye coordinates are found as

Similarly, if P is the projection matrix, then the vertex's clip coordinates are

The vertex's normalized device coordinates are then





David Blythe
Sat Mar 29 02:23:21 PST 1997