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

gluNurbsCurve Subroutine

Purpose

Defines the shape of a non-uniform rational B-spline (NURBS) curve.

Library

OpenGL C bindings library: libGL.a

C Syntax

void gluNurbsCurve(GLUnurbs* nurb, 
   GLint knotCount, 
   GLfloat *knots, 
   GLint stride, 
   GLfloat *control, 
   GLint order, 
   GLenum type)

Description

Use the gluNurbsCurve subroutine to describe a NURBS curve. When this subroutine is displayed between a gluBeginCurve and gluEndCurve pair, it describes a curve to be rendered. Positional, texture, and color coordinates are established by presenting each as a separate gluNurbsCurve statement between gluBeginCurve and gluEndCurve pairs. No more than one call to gluNurbsCurve for each color, position, or texture data can be made within a single gluBeginCurve and gluEndCurve pair. Exactly one call must be made to describe the position of the curve (a type of GL_MAP1_VERTEX_3 or GL_MAP1_VERTEX_4 description).

When a gluNurbsCurve subroutine is displayed between a gluBeginTrim and gluEndTrim pair, it describes a trimming curve on a NURBS surface. If the Type parameter is GLU_MAP1_TRIM_2, it describes a curve in 2-dimensional (2D) (u and v) parameter space. If the type parameter is GLU_MAP1_TRIM_3, it describes a curve in 2D homogeneous (u, v, and w) parameter space. (See the gluBeginTrim subroutine for more information about trimming curves.)

Parameters

nurb Specifies the NURBS object created with the gluNewNurbsRenderer subroutine.
knotCount Specifies the number of knots defined in the knot parameter. knotCount should equal the number of control points plus the order.
knots Specifies an array of nondecreasing knot values. The length of this array is contained in the knotCount parameter.
stride Defines the offset (as a number of single-precision floating-point values) between successive curve control points.
control Specifies a pointer to an array of control points. These coordinates must agree with the type parameter specified below.
order Specifies the order of the NURBS curve. The order parameter equals degree + 1, meaning that a cubic curve has an order of 4.
type Indicates the type of the curve. If the curve is defined within a gluBeginCurve/gluEndCurve pair, the type may be any of the valid 1-dimensional evaluator type (such as GL_MAP1_VERTEX_3 or GL_MAP1_COLOR_4). If it is between a gluBeginTrim/gluEndTrim pair, the only valid types are GLU_MAP1_TRIM_2 or GLU_MAP1_TRIM_3.

Examples

The following commands render a textured NURBS curve with normals:

gluBeginCurve(nobj);
    gluNurbsCurve(nobj, ..., GL_MAP1_TEXTURE_COORD_2);
    gluNurbsCurve(nobj, ..., GL_MAP1_NORMAL);
    gluNurbsCurve(nobj, ..., GL_MAP1_VERTEX_4);
gluEndCurve(nobj);

Files

/usr/include/GL/gl.h Contains C language constraints, variable type definitions, and ANSI function prototypes for OpenGL.
Note: To define trim curves which stitch well, use gluPwlCurve.

Related Information

The gluBeginCurve subroutine, gluBeginTrim subroutine, gluNewNurbsRenderer subroutine, gluPwlCurve subroutine.

OpenGL Overview.


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