GLUNURBSCALBACK(3G) GLUNURBSCALBACK(3G)
NAME
gluNurbsCallback - define a callback for a NURBS object
C SPECIFICATION
void gluNurbsCallback( GLUnurbs* nurb,
GLenum which,
GLvoid * CallBackFunc )
PARAMETERS
nurb Specifies the NURBS object (created with
gluNewNurbsRenderer).
which Specifies the callback being defined. Valid values are
GLUNURBSBEGIN, GLUNURBSVERTEX, GLUNURBSNORMAL,
GLUNURBSCOLOR, GLUNURBSTEXTURECORD, GLUNURBSEND,
GLUNURBSBEGINDATA, GLUNURBSVERTEXDATA,
GLUNURBSNORMALDATA, GLUNURBSCOLORDATA,
GLUNURBSTEXTURECORDATA, GLUNURBSENDATA, and
GLUNURBSEROR.
CallBackFunc Specifies the function that the callback calls.
DESCRIPTION
gluNurbsCallback is used to define a callback to be used by a NURBS
object. If the specified callback is already defined, then it is
replaced. If CallBackFunc is NUL, then this callback will not get
invoked and the related data, if any, will be lost.
Except the error callback, these callbacks are used by NURBS tessella-
tor (when GLUNURBSMODE is set to be GLUNURBSTESELATOR) to return
back the OpenGL polygon primitives resulting from the tessellation.
Note that there are two versions of each callback: one with a user data
pointer and one without. If both versions for a particular callback are
specified then the callback with the user data pointer will be used.
Note that ``userData'' is a copy of the pointer that was specified at
the last call to gluNurbsCallbackData.
The error callback function is effective no matter which value that
GLUNURBSMODE is set to. All other callback functions are effective
only when GLUNURBSMODE is set to GLUNURBSTESELATOR.
The legal callbacks are as follows:
GLUNURBSBEGIN
The begin callback indicates the start of a primitive. The
function takes a single argument of type GLenum, which can be
one of GLINES, GLINESTRIP, GLTRIANGLEFAN,
GLTRIANGLESTRIP, GLTRIANGLES, or GLQUADSTRIP. The
default begin callback function is NUL. The function proto-
type for this callback looks like:
void begin ( GLenum type );
GLUNURBSBEGINDATA
The same as the GLUNURBSBEGIN callback except that it takes
an additional pointer argument. This pointer is a copy of the
pointer that was specified at the last call to
gluNurbsCallbackData. The default callback function is NUL.
The function prototype for this callback function looks like:
void beginData (GLenum type, void *userData);
GLUNURBSVERTEX
The vertex callback indicates a vertex of the primitive. The
coordinates of the vertex are stored in the parameter ``ver-
tex''. All the generated vertices have dimension 3, that is,
homogeneous coordinates have been transformed into affine
coordinates. The default vertex callback function is NUL.
The function prototype for this callback function looks like:
void vertex ( GLfloat *vertex );
GLUNURBSVERTEXDATA
This is the same as the GLUNURBSVERTEX callback, except
that it takes an additional pointer argument. This pointer is
a copy of the pointer that was specified at the last call to
gluNurbsCallbackData. The default callback function is NUL.
The function prototype for this callback function looks like:
void vertexData ( GLfloat *vertex, void *userData );
GLUNURBSNORMAL
The normal callback is invoked as the vertex normal is gener-
ated. The components of the normal are stored in the parame-
ter ``normal''. In the case of a NURBS curve, the callback
function is effective only when the user provides a normal
map (GLMAP1NORMAL). In the case of a NURBS surface, if a
normal map (GLMAP2NORMAL) is provided, then the generated
normal is computed from the normal map. If a normal map is
not provided then a surface normal is computed in a manner
similar to that described for evaluators when GLAUTONORMAL
is enabled.
The default normal callback function is NUL. The function
prototype for this callback function looks like:
void normal ( GLfloat *normal );
GLUNURBSNORMALDATA
The same as the GLUNURBSNORMAL callback except that it
takes an additional pointer argument. This pointer is a copy
of the pointer that was specified at the last call to
gluNurbsCallbackData. The default callback function is NUL.
The function prototype for this callback function looks like:
void normalData ( GLfloat *normal, void *userData );
GLUNURBSCOLOR
The color callback is invoked as the color of a vertex is
generated. The components of the color are stored in the
parameter ``color''. This callback is effective only when
the user provides a color map (GLMAP1COLOR4 or
GLMAP2COLOR4). ``color'' contains four components:
R,G,B,A. The default color callback function is NUL. The
prototype for this callback function looks like:
void color ( GLfloat *color );
GLUNURBSCOLORDATA
The same as the GLUNURBSCOLOR callback except that it takes
an additional pointer argument. This pointer is a copy of the
pointer that was specified at the last call to
gluNurbsCallbackData. The default callback function is NUL.
The function prototype for this callback function looks like:
void colorData ( GLfloat *color, void *userData );
GLUNURBSTEXTURECORD
The texture callback is invoked as the texture coordinates of
a vertex are generated. These coordinates are stored in the
parameter ``texCoord''. The number of texture coordinates can
be 1, 2, 3, or 4 depending on which type of texture map is
specified (GLMAP1TEXTURECORD1, GLMAP1TEXTURECORD2,
GLMAP1TEXTURECORD3, GLMAP1TEXTURECORD4,
GLMAP2TEXTURECORD1, GLMAP2TEXTURECORD2,
GLMAP2TEXTURECORD3, GLMAP2TEXTURECORD4). If no
texture map is specified, this callback function will not be
called.
The default texture callback function is NUL. The function
prototype for this callback function looks like:
void texCoord ( GLfloat *texCoord );
GLUNURBSTEXTURECORDATA
This is the same as the GLUNURBSTEXTURECORD callback,
except that it takes an additional pointer argument. This
pointer is a copy of the pointer that was specified at the
last call to gluNurbsCallbackData. The default callback
function is NUL. The function prototype for this callback
function looks like:
void texCoordData (GLfloat *texCoord, void *userData);
GLUNURBSEND
The end callback is invoked at the end of a primitive. The
default end callback function is NUL. The function prototype
for this callback function looks like:
void end ( void );
GLUNURBSENDATA
This is the same as the GLUNURBSEND callback, except that
it takes an additional pointer argument. This pointer is a
copy of the pointer that was specified at the last call to
gluNurbsCallbackData. The default callback function is NUL.
The function prototype for this callback function looks like:
void endData ( void *userData );
GLUNURBSEROR
The error function is called when an error is encountered.
Its single argument is of type GLenum, and it indicates the
specific error that occurred. There are 37 errors unique to
NURBS named GLUNURBSEROR1 through GLUNURBSEROR37.
Character strings describing these errors can be retrieved
with gluErrorString.
NOTES
gluNurbsCallback is available only if the GLU version is 1.2 or
greater.
GLU version 1.2 supports only the GLUEROR parameter for which. The
GLUEROR value is deprecated in GLU version 1.3 in favor of
GLUNURBSEROR. All other accepted values for CallBackFunc are avail-
able only if the GLU version is 1.3 or greater.
SEE ALSO
gluErrorString, gluNewNurbsRenderer, gluNurbsCallbackData,
gluNurbsProperty
GLUNURBSCALBACK(3G)
|