Contents / Previous / Next


Additional Clipping Planes

In addition to the six clipping planes of the viewing volume (left, right, bottom, top, near, and far), you can define up to six additional clipping planes to further restrict the viewing volume.

Each plane is specified by the coefficients of its equation:
Ax+By+Cz+D =0.

 void glClipPlane(GLenum plane, const GLdouble *equation); 
Defines a clipping plane. The equation argument points to the four coefficients of the plane equation, Ax+By+Cz+D = 0.
All points with eye coordinates (xe, ye,ze, we)
that satisfy (A B C D)M-1 (xe ye ze we)T >= 0
lie in the half-space defined by the plane, where M is the current modelview matrix at the time glClipPlane() is called (T stands for transposed). All points not in this half-space are clipped away.

The plane argument is GL_CLIP_PLANEi, where i is an integer specifying which of the available clipping planes to define. i is a number between 0 and one less than the maximum number of additional clipping planes.

You need to enable/disable each additional clipping plane you define:

glEnable(GL_CLIP_PLANEi);
glDisable(GL_CLIP_PLANEi);
All implementations of OpenGL must support at least six additional clipping planes, although some implementations may allow more. You can use glGetIntegerv() with GL_MAX_CLIP_PLANES to find how many clipping planes are supported.

Example:

 gl.glEnable( GL.GL_CLIP_PLANE1 );
 double equation[] = { 1f, 1f, 1f, 1f};
 gl.glClipPlane( GL.GL_CLIP_PLANE1 , equation, 0 );