[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
OpenGL 1.2 for AIX: Reference Manual

gluBeginTrim or gluEndTrim Subroutine

Purpose

Delimits the beginning or end of a non-uniform rational B-spline (NURBS) trimming loop definition.

Library

OpenGL C bindings library: libGL.a

C Syntax

void gluBeginTrim(GLUnurbs* nurb)
void gluEndTrim(GLUnurbs* nurb)

Description

Use the gluBeginTrim subroutine to mark the beginning of a NURBS trimming loop. A trimming loop is a set of oriented curve segments (forming a closed curve) that define boundaries of a NURBS surface. Trimming loops are included in a NURBS surface definition between calls to the gluBeginSurface and gluEndSurface subroutine pair.

Use the gluEndTrim subroutine to mark the end of a trimming loop.

The definition for a NURBS surface can contain multiple trimming loops. For example, if a NURBS surface definition resembles a rectangle with a hole through it, the definition contains two trimming loops. One trimming loop defines the outer edge of the rectangle and the other defines the hole in the rectangle. Definitions for each of these trimming loops are bracketed by a gluBeginTrim and gluEndTrim subroutine pair.

The definition of a single closed trimming loop can consist of multiple curve segments, each described as a piecewise linear curve or as a single NURBS curve, or a combination of both in any order. (See the gluPwlCurve subroutine for details on defining a piecewise linear NURBS trimming curve; and the gluNurbsCurve subroutine for details on defining a NURBS curve.) The only library calls that can appear in a trimming loop definition (between the calls to the gluBeginTrim and gluEndTrim subroutine) are gluPwlCurve and gluNurbsCurve.

The region of the NURBS surface displayed is in the domain to the left of the trimming curve as the curve parameter increases. Therefore, the retained region of the NURBS surface is inside a counterclockwise trimming loop and outside a clockwise trimming loop. Using the rectangle with the hole mentioned in the preceding example, the trimming loop for the outer edge of the rectangle runs counterclockwise; the trimming loop for the hole runs clockwise.

If you use more than one curve to define a single trimming loop, the curve segments must form a closed loop. That is, the endpoint of each curve must be the starting point of the next curve and the endpoint of the final curve must be the starting point of the first curve. If the endpoints of these curves are sufficiently close together but not precisely coincident, they are forced to meet. If the endpoints are not sufficiently close, an error is generated. (See gluNurbsCallback for details on defining a NURBS object callback.)

If a trimming loop definition contains multiple curves, the direction of the curves must be consistent. (The inside must be to the left of the curves.) Nested trimming loops are acceptable as long as curve orientations alternate correctly. Trimming curves cannot be self-intersecting; nor can they intersect each other.

If no trimming information is given for a NURBS surface, the entire surface is drawn.

Parameters

nurb Specifies the NURBS object created with the gluNewNurbsRenderer subroutine.

Examples

This code fragment defines a trimming loop that consists of one piecewise linear curve and two NURBS curves:

gluBeginTrim(nobj);
   gluPwlCurve(..., GL_MAP1_TRIM_2);
   gluNurbsCurve(..., GL_MAP1_TRIM_2);
   gluNurbsCurve(..., GL_MAP1_TRIM_3);
gluEndTrim(nobj);

Files

/usr/include/GL/gl.h Contains C language constraints, variable type definitions, and ANSI function prototypes for OpenGL.

Related Information

The gluBeginSurface subroutine, gluNewNurbsRenderer subroutine, gluNurbsCallback subroutine, gluNurbsCurve subroutine, gluPwlCurve subroutine.

OpenGL Overview.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]