aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/extras/ogl-sample/main/doc/man/manglu/standard/nurbscallback.gl
blob: 953d01bca6a9a69368ee4695c4ac5e34b8ee7ff0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
_C_ License Applicability. Except to the extent portions of this file are
_C_ made subject to an alternative license as permitted in the SGI Free
_C_ Software License B, Version 1.1 (the "License"), the contents of this
_C_ file are subject only to the provisions of the License. You may not use
_C_ this file except in compliance with the License. You may obtain a copy
_C_ of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
_C_ Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
_C_ 
_C_ http://oss.sgi.com/projects/FreeB
_C_ 
_C_ Note that, as provided in the License, the Software is distributed on an
_C_ "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
_C_ DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
_C_ CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
_C_ PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
_C_ 
_C_ Original Code. The Original Code is: OpenGL Sample Implementation,
_C_ Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
_C_ Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
_C_ Copyright in any portions created by third parties is as indicated
_C_ elsewhere herein. All Rights Reserved.
_C_ 
_C_ Additional Notice Provisions: The application programming interfaces
_C_ established by SGI in conjunction with the Original Code are The
_C_ OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
_C_ April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
_C_ 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
_C_ Window System(R) (Version 1.3), released October 19, 1998. This software
_C_ was created using the OpenGL(R) version 1.2.1 Sample Implementation
_C_ published by SGI, but has not been independently verified as being
_C_ compliant with the OpenGL(R) version 1.2.1 Specification.
_C_
_C_ $Date: 2004/03/14 08:29:09 $ $Revision: 1.1.1.4 $
_C_ The first character in this file must be an '_'!
_C_ Anything on a line after _C_ is ignored
_define(_filters,eqn)_C_
_C_      eqn is automatically replaced with neqn for nroff
_header(NurbsCallback, define a callback for a NURBS object)
_names(NurbsCallback)
.EQ
delim $$
.EN
.SH PARAMETERS
_phead(_param1)
Specifies the NURBS object (created with _cmnd(NewNurbsRenderer)).
_phead(_param2)
Specifies the callback being defined. 
Valid values are _gluconst(NURBS_BEGIN), _gluconst(NURBS_VERTEX), _gluconst(NURBS_NORMAL), _gluconst(NURBS_COLOR), _gluconst(NURBS_TEXTURE_COORD), _gluconst(NURBS_END), _gluconst(NURBS_BEGIN_DATA), _gluconst(NURBS_VERTEX_DATA), _gluconst(NURBS_NORMAL_DATA), _gluconst(NURBS_COLOR_DATA), _gluconst(NURBS_TEXTURE_COORD_DATA), _gluconst(NURBS_END_DATA), and _gluconst(NURBS_ERROR).
_phead(_param3)
Specifies the function that the callback calls.
.SH DESCRIPTION
_cmnd 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 
_param3 is NULL, then this callback will not get
invoked and the related data, if any, will be lost.
.P
Except the error callback, these callbacks are used by NURBS tessellator (when _gluconst(NURBS_MODE) is set to be _gluconst(NURBS_TESSELLATOR)) 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 _cmnd(NurbsCallbackData).
.P
The error callback function is effective no matter which value that
_gluconst(NURBS_MODE) is set to.
All other callback functions are effective only when _gluconst(NURBS_MODE)
is set to _gluconst(NURBS_TESSELLATOR).
.P
The legal callbacks are as follows:
.TP 10
_gluconst(NURBS_BEGIN)
The begin callback indicates the start of a primitive. The function
takes a single argument of type GLenum, which can be one of 
_const(LINES), _const(LINE_STRIP), _const(TRIANGLE_FAN), _const(TRIANGLE_STRIP), _const(TRIANGLES), or _const(QUAD_STRIP). The
default begin callback function is NULL. The function prototype
for this callback looks like:
.RS
.Ex
void begin ( GLenum type );
.Ee
.RE
.TP
_gluconst(NURBS_BEGIN_DATA)
The same as the _gluconst(NURBS_BEGIN) 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 _cmnd(NurbsCallbackData).  The
default callback function is NULL. The function prototype for this
callback function looks like:
.RS
.Ex
void beginData (GLenum type, void *userData);
.Ee
.RE
.TP
_gluconst(NURBS_VERTEX)
The vertex callback indicates a vertex of the primitive. The
coordinates of the vertex are stored in the parameter ``vertex''. All
the generated vertices have dimension 3, that is, homogeneous
coordinates have been transformed into affine coordinates. The default
vertex callback function is NULL. The function prototype for this
callback function looks like:
.RS
.Ex
void vertex ( GLfloat *vertex );
.Ee
.RE
.TP
_gluconst(NURBS_VERTEX_DATA)
This is the same as the _gluconst(NURBS_VERTEX) 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
_cmnd(NurbsCallbackData).  The default callback function is NULL. The
function prototype for this callback function looks like:
.RS
.Ex
void vertexData ( GLfloat *vertex, void *userData );
.Ee
.RE
.TP
_gluconst(NURBS_NORMAL)
The normal callback is invoked as the vertex normal is generated.
The components of the normal are stored in the parameter ``normal''.
In the case of a NURBS curve, the callback function is effective only when 
the user provides a normal map (_const(MAP1_NORMAL)).
In the case of a NURBS surface, if a normal map (_const(MAP2_NORMAL)) 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 _const(AUTO_NORMAL)
is enabled. 
.bp
The default normal callback function is NULL. The function
prototype for this callback function looks like:
.RS
.Ex
void normal ( GLfloat *normal );
.Ee
.RE
.TP
_gluconst(NURBS_NORMAL_DATA)
The same as the _gluconst(NURBS_NORMAL) 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 _cmnd(NurbsCallbackData).  The default callback function is NULL. The function prototype for this callback function looks like:
.RS
.Ex
void normalData ( GLfloat *normal, void *userData );
.Ee
.RE
.TP
_gluconst(NURBS_COLOR)
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
(_const(MAP1_COLOR_4) or _const(MAP2_COLOR_4)). ``color'' contains four components: R,G,B,A. The default color callback function is NULL. The prototype for
this callback function looks like:
.RS
.Ex
void color ( GLfloat *color );
.Ee
.RE
.TP
_gluconst(NURBS_COLOR_DATA)
The same as the _gluconst(NURBS_COLOR) 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 _cmnd(NurbsCallbackData).  The default callback function is NULL. The function prototype for this callback function looks like:
.RS
.Ex
void colorData ( GLfloat *color, void *userData );
.Ee
.RE
.TP
_gluconst(NURBS_TEXTURE_COORD)
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 
(_const(MAP1_TEXTURE_COORD_1),
_const(MAP1_TEXTURE_COORD_2),
_const(MAP1_TEXTURE_COORD_3),
_const(MAP1_TEXTURE_COORD_4),
_const(MAP2_TEXTURE_COORD_1),
_const(MAP2_TEXTURE_COORD_2),
_const(MAP2_TEXTURE_COORD_3),
_const(MAP2_TEXTURE_COORD_4)).
If no texture map is specified, this callback function will not be called.
.bp
The default texture callback function is NULL. The function prototype
for this callback function looks like:
.RS
.Ex
void texCoord ( GLfloat *texCoord );
.Ee
.RE
.TP
 _gluconst(NURBS_TEXTURE_COORD_DATA)
This is the same as the _gluconst(NURBS_TEXTURE_COORD) 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 _cmnd(NurbsCallbackData).  The default callback function is NULL. The function prototype for this callback function looks like:
.RS
.Ex
void texCoordData (GLfloat *texCoord, void *userData);
.Ee
.RE
.TP
_gluconst(NURBS_END)
The end callback is invoked at the end of a primitive. The default end callback function is NULL. The function prototype for this callback function looks like:
.RS
.Ex
void end ( void );
.Ee
.RE
.TP
_gluconst(NURBS_END_DATA)
This is the same as the _gluconst(NURBS_END) 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 _cmnd(NurbsCallbackData).  The default callback function is NULL. The function prototype for this callback function looks like:
.RS
.Ex
void endData ( void  *userData );
.Ee
.RE
.TP
_gluconst(NURBS_ERROR)
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
_gluconst(NURBS_ERROR1) through _gluconst(NURBS_ERROR37). 
Character strings describing these errors can be retrieved with
_cmnd(ErrorString).
.bp
.SH NOTES
_cmnd is available only if the GLU version is 1.2 or greater.
.P
GLU version 1.2 supports only the _gluconst(ERROR) parameter for
_param2. The _gluconst(ERROR) value is deprecated in GLU version 1.3 in
favor of _gluconst(NURBS_ERROR).  All other accepted values for _param3
are available only if the GLU version is 1.3 or greater.
.SH SEE ALSO
_cmnd(ErrorString),
_cmnd(NewNurbsRenderer),
_cmnd(NurbsCallbackData),
_cmnd(NurbsProperty)