gluNurbsSurface
The gluNurbsSurface function defines the shape of a NURBS surface.
void gluNurbsSurface(
GLUnurbsObj *nobj, GLint sknot_count, GLfloat *sknot, GLint tknot_count, GLfloat *tknot, GLint s_stride, GLint t_stride, GLfloat *ctlarray, GLint sorder, GLint torder, GLenum type);
Parameters
- nobj
The NURBS object (created with gluNewNurbsRenderer). - sknot_count
The number of knots in the parametric u direction. - sknot
An array of sknot_count nondecreasing knot values in the parametric u direction. - tknot_count
The number of knots in the parametric v direction. - tknot
An array of tknot_count nondecreasing knot values in the parametric v direction. - s_stride
The offset (as a number of single precisionfloating-point values) between successive control points in the parametric u direction in ctlarray. - t_stride
The offset (in single precisionfloating-point values) between successive control points in the parametric v direction in ctlarray. - ctlarray
An array containing control points for the NURBS surface. The offsets between successive control points in the parametric u and v directions are given by s_stride and t_stride. - sorder
The order of the NURBS surface in the parametric u direction. The order is one more than the degree, hence a surface that is cubic in u has a u order of 4. - torder
The order of the NURBS surface in the parametric v direction. The order is one more than the degree, hence a surface that is cubic in v has a v order of 4. - type
The type of the surface. The type parameter can be any of the valid two-dimensional evaluator types (such as GL_MAP2_VERTEX_3 or GL_MAP2_COLOR_4).
Remarks
Use gluNurbsSurface within a NURBS (Non-Uniform Rational B-Spline) surface definition to describe the shape of a NURBS surface (before any trimming). To mark the beginning of a NURBS surface definition, use the gluBeginSurface function. To mark the end of a NURBS surface definition, use the gluEndSurface function. Call gluNurbsSurface within a NURBS surface definition only.
You associate positional, texture, and color coordinates with a surface by presenting each as a separate gluNurbsSurface between a gluBeginSurface/gluEndSurface pair. Within a single gluBeginSurface/gluEndSurface pair, you can make only one call to gluNurbsSurface for color, position, and texture data. Make exactly one call to describe the position of the surface (a type of GL_MAP2_VERTEX_3 or GL_MAP2_VERTEX_4).
You can trim a NURBS surface by using the gluNurbsCurve and gluPwlCurve functions between calls to gluBeginTrim and gluEndTrim.
Note A gluNurbsSurface with sknot_count knots in the u direction and tknot_count knots in the v direction with orders sorder and torder must have (sknot_count - sorder) multipied by (tknot_count - torder) control points.
Example
The following functions render a textured NURBS surface with normals; the texture coordinates and normals are also NURBS surfaces:
gluBeginSurface(nobj); gluNurbsSurface(nobj, . . ., GL_MAP2_TEXTURE_COORD_2); gluNurbsSurface(nobj, . . ., GL_MAP2_NORMAL); gluNurbsSurface(nobj, . . ., GL_MAP2_VERTEX_4); gluEndSurface(nobj);
Requirements
** Windows NT/2000:** Requires Windows NT 3.5 or later.
** Windows 95/98:** Requires Windows 95 or later. Available as a redistributable for Windows 95.
** Header:** Declared in Glu.h.
** Library:** Use Glu32.lib.
See Also
gluBeginSurface, gluBeginTrim, gluEndSurface, gluEndTrim, gluNewNurbsRenderer, gluNurbsCurve, gluPwlCurve