Next: 4.3 Rasterization Up: 4 The OpenGL Pipeline Previous: 4.1 Vertices and Primitives

4.2 Clipping and Projection

Once a primitive has been assembled from a group of vertices, it is subjected to clipping by clip planes. The positions of these planes (every OpenGL implementation must provide at least six) is specifiable using the glClipPlane command. Each plane may be enabled or disabled individually.

In the case of a point, the clip planes either have no effect on the point or annihilate it depending as the point lies inside or outside the intersection of the half-spaces determined by the clip planes. In the case of a line segment or polygon, the clip planes may have no effect on, annihilate, or alter the original primitive. In the later case, new vertices may be created between edges described by original vertices; color and texture coordinate values for these new vertices are found by appropriately interpolating the values assigned to the original vertices.

After the clip planes (if any) have been applied, the vertex coordinates of the resulting primitive are transformed by the projection matrix. Then view frustum clipping occurs. View frustum clipping is like clip plane application, but with fixed planes: if coordinates after transformation are given by , then the six half spaces defined by these planes are , , , , , .

With view frustum clipping completed, each group of vertex coordinates is projected by computing , , and . The resulting values (which must each lie in [-1,1]) are multiplied and offset by parameters that control the size of the viewport into which primitives are to be drawn. The glViewport (for and ) and glDepthRange (for ) commands control these parameters.


segal@asd.sgi.com
Fri Sep 23 16:08:14 PDT 1994