Primitives are clipped to the * clip volume*.
In clip coordinates,
the * view volume* is defined by

This view volume may be further restricted by as many as **n** client-defined
clip planes to generate the clip volume.
(**n** is an implementation dependent maximum that must be at least **6**.)
Each client-defined plane specifies a half-space.
The clip volume is the intersection of all such half-spaces
with the view volume (if there no client-defined clip planes are enabled,
the clip volume is the view volume).

A client-defined clip plane is specified with

` void` ** ClipPlane** ( ` enum` * p*, ` double` * eqn[4]* ) ` ;`

The value of the first argument, * p*, is a symbolic constant,
` CLIP_PLANE i`, where

(where **M** is the current model-view matrix;
the resulting plane equation
is undefined if **M** is singular and may be inaccurate if
**M** is poorly-conditioned) to obtain the plane equation
coefficients in eye coordinates.
All points with eye coordinates
that satisfy

lie in the half-space defined by the plane; points that do not satisfy this condition do not lie in the half-space.

Client-defined clip planes are enabled with the generic
** Enable** command and
disabled with the ** Disable** command.
The value of the argument to either command is
` CLIP_PLANE i` where

If the primitive under consideration is a point, then clipping passes it unchanged if it lies within the clip volume; otherwise, it is discarded. If the primitive is a line segment, then clipping does nothing to it if it lies entirely within the clip volume and discards it if it lies entirely outside the volume. If part of the line segment lies in the volume and part lies outside, then the line segment is clipped and new vertex coordinates are computed for one or both vertices. A clipped line segment endpoint lies on both the original line segment and the boundary of the clip volume.

This clipping produces a value,
,
for each clipped vertex.
If the coordinates of a clipped vertex are
and the original vertices' coordinates are
and ,
then **t** is given by

The value of **t** is used in color and texture coordinate clipping
(section 2.13.8).

If the primitive is a polygon,
then it is passed if every one of its edges lies
entirely inside the clip volume
and either clipped or discarded otherwise.
Polygon clipping may cause polygon edges to be clipped,
but because polygon connectivity must be maintained,
these clipped edges
are connected by new edges that lie along the clip volume's boundary.
Thus, clipping may require the introduction of new vertices into a polygon.
Edge flags are associated with these vertices so that edges introduced
by clipping are flagged as boundary (edge flag ` TRUE`),
and so that original edges of the polygon that become cut off
at these vertices retain their original flags.

If it happens that a polygon intersects an edge of the clip volume's boundary, then the clipped polygon must include a point on this boundary edge. This point must lie in the intersection of the boundary edge and the convex hull of the vertices of the original polygon. We impose this requirement because the polygon may not be exactly planar.

A line segment or polygon whose vertices have values of differing signs may generate multiple connected components after clipping. GL implementations are not required to handle this situation. That is, only the portion of the primitive that lies in the region of need be produced by clipping.

Primitives rendered with clip planes must satisfy a complementarity criterion. Suppose a single clip plane with coefficients (or a number of similarly specified clip planes) is enabled and a series of primitives are drawn. Next, suppose that the original clip plane is respecified with coefficients (and correspondingly for any other clip planes) and the primitives are drawn again (and the GL is otherwise in the same state). In this case, primitives must not be missing any pixels, nor may any pixels be drawn twice in regions where those primitives are cut by the clip planes.

Clipping requires at least 6 sets of plane equations (each consisting of four double-precision floating-point coefficients) and at least 6 corresponding bits indicating which of these client-defined plane equations are enabled. In the initial state, all client-defined plane equation coefficients are zero and all planes are disabled.

Sat Mar 29 02:23:21 PST 1997