gluBeginCurve — delimit a NURBS curve definition
C Specification
void gluBeginCurve( | GLUnurbs* | nurb) ; |
C Specification
void gluEndCurve( | GLUnurbs* | nurb) ; |
Parameters
nurb
- Specifies the NURBS object (created with gluNewNurbsRenderer).
Description
UsegluBeginCurve
to mark the beginning of a NURBS curve definition. After calling gluBeginCurve
, make one or more calls to gluNurbsCurve to define the attributes of the curve. Exactly one of the calls to gluNurbsCurve must have a curve type of GLU_MAP1_VERTEX_3
or GLU_MAP1_VERTEX_4
. To mark the end of the NURBS curve definition, call gluEndCurve.GL evaluators are used to render the NURBS curve as a series of line segments. Evaluator state is preserved during rendering with glPushAttrib(
GLU_EVAL_BIT
) and glPopAttrib(). See the glPushAttrib reference page for details on exactly what state these calls preserve.Example of gluBeginCurve
The following commands render a textured NURBS curve with normals; texture coordinates and normals are also specified as NURBS curves:<Example 1>
gluBeginCurve(nobj); gluNurbsCurve(nobj, ..., GL_MAP1_TEXTURE_COORD_2); gluNurbsCurve(nobj, ..., GL_MAP1_NORMAL); gluNurbsCurve(nobj, ..., GL_MAP1_VERTEX_4); gluEndCurve(nobj);
<Example 2>
glColor3f(CS390_CURVE_COLOR); /* select a drawing color */
glLineWidth(2); /* select a line width */
if(n >= 2) { /* draw curve only if n >= 2 */
glShadeModel(GL_FLAT); /* select a shading model */
glEnable(GL_MAP1_VERTEX_3); /* activate mapping and do it */
gluBeginCurve(theNurbs); /* start NURBS curve drawing */
gluNurbsCurve(theNurbs, /* draw a NURBS curve */
m, /* # of knots */
&knot_v[0], /* knot vector */
3, /* u stride */
&points_v[0][0], /* control points array */
p + 1, /* order = degree + 1 */
GL_MAP1_VERTEX_3); /* do it as here */
gluEndCurve(theNurbs); /* end of NURBS curve drawing */
}