Revert "update upstream sources"
[clinton/guile-figl.git] / doc / low-level-glu.texi
CommitLineData
8925f36f
AW
1
2@c %start of fragment
3
3c9b6116
AW
4The functions from this section may be had by loading the module:
5
6@example
7ec693ed 7(use-modules (figl glu low-level)
3c9b6116
AW
8@end example
9
8925f36f
AW
10@copying
11This section of the manual was derived from the upstream OpenGL
f37e7e3d
DH
12documentation. Each function's documentation has its own copyright
13statement; for full details, see the upstream documentation. The
8925f36f
AW
14copyright notices and licenses present in this section are as follows.
15
f37e7e3d
DH
16Copyright @copyright{} 1991-2006 Silicon Graphics, Inc. This document is
17licensed under the SGI Free Software B License. For details, see
8925f36f
AW
18@uref{http://oss.sgi.com/projects/FreeB/,http://oss.sgi.com/projects/FreeB/}.
19
20@end copying
21
bb894c9d
AW
22@deftypefun void gluBeginCurve nurb
23@deftypefunx void gluEndCurve nurb
3c9b6116
AW
24Delimit a NURBS curve definition.
25
8925f36f
AW
26@table @asis
27@item @var{nurb}
28Specifies the NURBS object (created with @code{gluNewNurbsRenderer}).
29
30@end table
31
8925f36f 32Use @code{gluBeginCurve} to mark the beginning of a NURBS curve
f37e7e3d
DH
33definition. After calling @code{gluBeginCurve}, make one or more calls
34to @code{gluNurbsCurve} to define the attributes of the curve. Exactly
8925f36f 35one of the calls to @code{gluNurbsCurve} must have a curve type of
f37e7e3d
DH
36@code{GLU_MAP1_VERTEX_3} or @code{GLU_MAP1_VERTEX_4}. To mark the end of
37the NURBS curve definition, call @code{gluEndCurve}.
8925f36f
AW
38
39GL evaluators are used to render the NURBS curve as a series of line
f37e7e3d
DH
40segments. Evaluator state is preserved during rendering with
41@code{glPushAttrib}(@code{GLU_EVAL_BIT}) and @code{glPopAttrib}(). See
8925f36f
AW
42the @code{glPushAttrib} reference page for details on exactly what state
43these calls preserve.
44
bb894c9d 45@end deftypefun
8925f36f 46
bb894c9d
AW
47@deftypefun void gluBeginPolygon tess
48@deftypefunx void gluEndPolygon tess
3c9b6116
AW
49Delimit a polygon description.
50
8925f36f
AW
51@table @asis
52@item @var{tess}
53Specifies the tessellation object (created with @code{gluNewTess}).
54
55@end table
56
8925f36f 57@code{gluBeginPolygon} and @code{gluEndPolygon} delimit the definition
f37e7e3d
DH
58of a nonconvex polygon. To define such a polygon, first call
59@code{gluBeginPolygon}. Then define the contours of the polygon by
8925f36f 60calling @code{gluTessVertex} for each vertex and @code{gluNextContour}
f37e7e3d
DH
61to start each new contour. Finally, call @code{gluEndPolygon} to signal
62the end of the definition. See the @code{gluTessVertex} and
8925f36f
AW
63@code{gluNextContour} reference pages for more details.
64
65Once @code{gluEndPolygon} is called, the polygon is tessellated, and the
f37e7e3d 66resulting triangles are described through callbacks. See
8925f36f
AW
67@code{gluTessCallback} for descriptions of the callback functions.
68
bb894c9d 69@end deftypefun
8925f36f 70
bb894c9d
AW
71@deftypefun void gluBeginSurface nurb
72@deftypefunx void gluEndSurface nurb
3c9b6116
AW
73Delimit a NURBS surface definition.
74
8925f36f
AW
75@table @asis
76@item @var{nurb}
77Specifies the NURBS object (created with @code{gluNewNurbsRenderer}).
78
79@end table
80
8925f36f 81Use @code{gluBeginSurface} to mark the beginning of a NURBS surface
f37e7e3d
DH
82definition. After calling @code{gluBeginSurface}, make one or more calls
83to @code{gluNurbsSurface} to define the attributes of the surface.
8925f36f 84Exactly one of these calls to @code{gluNurbsSurface} must have a surface
f37e7e3d 85type of @code{GLU_MAP2_VERTEX_3} or @code{GLU_MAP2_VERTEX_4}. To mark
8925f36f
AW
86the end of the NURBS surface definition, call @code{gluEndSurface}.
87
88Trimming of NURBS surfaces is supported with @code{gluBeginTrim},
f37e7e3d
DH
89@code{gluPwlCurve}, @code{gluNurbsCurve}, and @code{gluEndTrim}. See the
90@code{gluBeginTrim} reference page for details.
8925f36f
AW
91
92GL evaluators are used to render the NURBS surface as a set of polygons.
93Evaluator state is preserved during rendering with
f37e7e3d
DH
94@code{glPushAttrib}(@code{GLU_EVAL_BIT}) and @code{glPopAttrib}. See the
95@code{glPushAttrib} reference page for details on exactly what state
8925f36f
AW
96these calls preserve.
97
bb894c9d 98@end deftypefun
8925f36f 99
bb894c9d
AW
100@deftypefun void gluBeginTrim nurb
101@deftypefunx void gluEndTrim nurb
3c9b6116
AW
102Delimit a NURBS trimming loop definition.
103
8925f36f
AW
104@table @asis
105@item @var{nurb}
106Specifies the NURBS object (created with @code{gluNewNurbsRenderer}).
107
108@end table
109
8925f36f 110Use @code{gluBeginTrim} to mark the beginning of a trimming loop and
f37e7e3d
DH
111@code{gluEndTrim} to mark the end of a trimming loop. A trimming loop is
112a set of oriented curve segments (forming a closed curve) that define
113boundaries of a NURBS surface. You include these trimming loops in the
8925f36f
AW
114definition of a NURBS surface, between calls to @code{gluBeginSurface}
115and @code{gluEndSurface}.
116
f37e7e3d 117The definition for a NURBS surface can contain many trimming loops. For
8925f36f
AW
118example, if you wrote a definition for a NURBS surface that resembled a
119rectangle with a hole punched out, the definition would contain two
f37e7e3d
DH
120trimming loops. One loop would define the outer edge of the rectangle;
121the other would define the hole punched out of the rectangle. The
8925f36f
AW
122definitions of each of these trimming loops would be bracketed by a
123@code{gluBeginTrim}/@code{gluEndTrim} pair.
124
125The definition of a single closed trimming loop can consist of multiple
126curve segments, each described as a piecewise linear curve (see
127@code{gluPwlCurve}) or as a single NURBS curve (see
f37e7e3d 128@code{gluNurbsCurve}), or as a combination of both in any order. The
8925f36f
AW
129only library calls that can appear in a trimming loop definition
130(between the calls to @code{gluBeginTrim} and @code{gluEndTrim}) are
131@code{gluPwlCurve} and @code{gluNurbsCurve}.
132
133The area of the NURBS surface that is displayed is the region in the
134domain to the left of the trimming curve as the curve parameter
f37e7e3d 135increases. Thus, the retained region of the NURBS surface is inside a
8925f36f
AW
136counterclockwise trimming loop and outside a clockwise trimming loop.
137For the rectangle mentioned earlier, the trimming loop for the outer
138edge of the rectangle runs counterclockwise, while the trimming loop for
139the punched-out hole runs clockwise.
140
141If you use more than one curve to define a single trimming loop, the
142curve segments must form a closed loop (that is, the endpoint of each
143curve must be the starting point of the next curve, and the endpoint of
f37e7e3d 144the final curve must be the starting point of the first curve). If the
8925f36f 145endpoints of the curve are sufficiently close together but not exactly
f37e7e3d 146coincident, they will be coerced to match. If the endpoints are not
8925f36f
AW
147sufficiently close, an error results (see @code{gluNurbsCallback}).
148
149If a trimming loop definition contains multiple curves, the direction of
150the curves must be consistent (that is, the inside must be to the left
f37e7e3d
DH
151of all of the curves). Nested trimming loops are legal as long as the
152curve orientations alternate correctly. If trimming curves are
8925f36f
AW
153self-intersecting, or intersect one another, an error results.
154
155If no trimming information is given for a NURBS surface, the entire
156surface is drawn.
157
bb894c9d 158@end deftypefun
8925f36f 159
bb894c9d 160@deftypefun GLint gluBuild1DMipmapLevels target internalFormat width format type level base max data
3c9b6116
AW
161Builds a subset of one-dimensional mipmap levels.
162
8925f36f
AW
163@table @asis
164@item @var{target}
f37e7e3d 165Specifies the target texture. Must be @code{GLU_TEXTURE_1D}.
8925f36f
AW
166
167@item @var{internalFormat}
f37e7e3d 168Requests the internal storage format of the texture image. The most
8925f36f
AW
169current version of the SGI implementation of GLU does not check this
170value for validity before passing it on to the underlying OpenGL
f37e7e3d
DH
171implementation. A value that is not accepted by the OpenGL
172implementation will lead to an OpenGL error. The benefit of not checking
173this value at the GLU level is that OpenGL extensions can add new
174internal texture formats without requiring a revision of the GLU
175implementation. Older implementations of GLU check this value and raise
8925f36f
AW
176a GLU error if it is not 1, 2, 3, or 4 or one of the following symbolic
177constants: @code{GLU_ALPHA}, @code{GLU_ALPHA4}, @code{GLU_ALPHA8},
178@code{GLU_ALPHA12}, @code{GLU_ALPHA16}, @code{GLU_LUMINANCE},
179@code{GLU_LUMINANCE4}, @code{GLU_LUMINANCE8}, @code{GLU_LUMINANCE12},
180@code{GLU_LUMINANCE16}, @code{GLU_LUMINANCE_ALPHA},
181@code{GLU_LUMINANCE4_ALPHA4}, @code{GLU_LUMINANCE6_ALPHA2},
182@code{GLU_LUMINANCE8_ALPHA8}, @code{GLU_LUMINANCE12_ALPHA4},
183@code{GLU_LUMINANCE12_ALPHA12}, @code{GLU_LUMINANCE16_ALPHA16},
184@code{GLU_INTENSITY}, @code{GLU_INTENSITY4}, @code{GLU_INTENSITY8},
185@code{GLU_INTENSITY12}, @code{GLU_INTENSITY16}, @code{GLU_RGB},
186@code{GLU_R3_G3_B2}, @code{GLU_RGB4}, @code{GLU_RGB5}, @code{GLU_RGB8},
187@code{GLU_RGB10}, @code{GLU_RGB12}, @code{GLU_RGB16}, @code{GLU_RGBA},
188@code{GLU_RGBA2}, @code{GLU_RGBA4}, @code{GLU_RGB5_A1},
189@code{GLU_RGBA8}, @code{GLU_RGB10_A2}, @code{GLU_RGBA12}, or
190@code{GLU_RGBA16}.
191
192@item @var{width}
f37e7e3d 193Specifies the width in pixels of the texture image. This should be a
8925f36f
AW
194power of 2.
195
196@item @var{format}
f37e7e3d 197Specifies the format of the pixel data. Must be one of:
8925f36f
AW
198@code{GLU_COLOR_INDEX}, @code{GLU_DEPTH_COMPONENT}, @code{GLU_RED},
199@code{GLU_GREEN}, @code{GLU_BLUE}, @code{GLU_ALPHA}, @code{GLU_RGB},
200@code{GLU_RGBA}, @code{GLU_BGR}, @code{GLU_BGRA}, @code{GLU_LUMINANCE},
201or @code{GLU_LUMINANCE_ALPHA}.
202
203@item @var{type}
f37e7e3d 204Specifies the data type for @var{data}. Must be one of:
8925f36f
AW
205@code{GLU_UNSIGNED_BYTE}, @code{GLU_BYTE}, @code{GLU_BITMAP},
206@code{GLU_UNSIGNED_SHORT}, @code{GLU_SHORT}, @code{GLU_UNSIGNED_INT},
207@code{GLU_INT}, @code{GLU_FLOAT}, @code{GLU_UNSIGNED_BYTE_3_3_2},
208@code{GLU_UNSIGNED_BYTE_2_3_3_REV}, @code{GLU_UNSIGNED_SHORT_5_6_5},
209@code{GLU_UNSIGNED_SHORT_5_6_5_REV}, @code{GLU_UNSIGNED_SHORT_4_4_4_4},
210@code{GLU_UNSIGNED_SHORT_4_4_4_4_REV},
211@code{GLU_UNSIGNED_SHORT_5_5_5_1},
212@code{GLU_UNSIGNED_SHORT_1_5_5_5_REV}, @code{GLU_UNSIGNED_INT_8_8_8_8},
213@code{GLU_UNSIGNED_INT_8_8_8_8_REV}, @code{GLU_UNSIGNED_INT_10_10_10_2},
214or @code{GLU_UNSIGNED_INT_2_10_10_10_REV}.
215
216@item @var{level}
217Specifies the mipmap level of the image data.
218
219@item @var{base}
220Specifies the minimum mipmap level to pass to @code{glTexImage1D}.
221
222@item @var{max}
223Specifies the maximum mipmap level to pass to @code{glTexImage1D}.
224
225@item @var{data}
226Specifies a pointer to the image data in memory.
227
228@end table
229
8925f36f
AW
230@code{gluBuild1DMipmapLevels} builds a subset of prefiltered
231one-dimensional texture maps of decreasing resolutions called a mipmap.
232This is used for the antialiasing of texture mapped primitives.
233
234A return value of zero indicates success, otherwise a GLU error code is
235returned (see @code{gluErrorString}).
236
237A series of mipmap levels from @var{base} to @var{max} is built by
f37e7e3d 238decimating @var{data} in half until size @r{1×1} is reached. At each
8925f36f 239level, each texel in the halved mipmap level is an average of the
f37e7e3d
DH
240corresponding two texels in the larger mipmap level. @code{glTexImage1D}
241is called to load these mipmap levels from @var{base} to @var{max}. If
8925f36f
AW
242@var{max} is larger than the highest mipmap level for the texture of the
243specified size, then a GLU error code is returned (see
244@code{gluErrorString}) and nothing is loaded.
245
246For example, if @var{level} is 2 and @var{width} is 16, the following
f37e7e3d
DH
247levels are possible: @r{16×1}, @r{8×1}, @r{4×1}, @r{2×1}, @r{1×1}. These
248correspond to levels 2 through 6 respectively. If @var{base} is 3 and
3c9b6116 249@var{max} is 5, then only mipmap levels @r{8×1}, @r{4×1} and @r{2×1} are
f37e7e3d 250loaded. However, if @var{max} is 7, then an error is returned and
3c9b6116
AW
251nothing is loaded since @var{max} is larger than the highest mipmap
252level which is, in this case, 6.
8925f36f
AW
253
254The highest mipmap level can be derived from the formula
3c9b6116 255@r{@var{log}_2⁡(@var{width}×2^@var{level},)}.
8925f36f
AW
256
257See the @code{glTexImage1D} reference page for a description of the
f37e7e3d 258acceptable values for @var{type} parameter. See the @code{glDrawPixels}
8925f36f
AW
259reference page for a description of the acceptable values for
260@var{level} parameter.
261
8925f36f
AW
262@code{GLU_INVALID_VALUE} is returned if @var{level} > @var{base},
263@var{base} < 0, @var{max} < @var{base} or @var{max} is > the highest
264mipmap level for @var{data}.
265
266@code{GLU_INVALID_VALUE} is returned if @var{width} is < 1.
267
268@code{GLU_INVALID_ENUM} is returned if @var{internalFormat},
269@var{format}, or @var{type} are not legal.
270
271@code{GLU_INVALID_OPERATION} is returned if @var{type} is
272@code{GLU_UNSIGNED_BYTE_3_3_2} or @code{GLU_UNSIGNED_BYTE_2_3_3_REV} and
273@var{format} is not @code{GLU_RGB}.
274
275@code{GLU_INVALID_OPERATION} is returned if @var{type} is
276@code{GLU_UNSIGNED_SHORT_5_6_5} or @code{GLU_UNSIGNED_SHORT_5_6_5_REV}
277and @var{format} is not @code{GLU_RGB}.
278
279@code{GLU_INVALID_OPERATION} is returned if @var{type} is
280@code{GLU_UNSIGNED_SHORT_4_4_4_4} or
281@code{GLU_UNSIGNED_SHORT_4_4_4_4_REV} and @var{format} is neither
282@code{GLU_RGBA} nor @code{GLU_BGRA}.
283
284@code{GLU_INVALID_OPERATION} is returned if @var{type} is
285@code{GLU_UNSIGNED_SHORT_5_5_5_1} or
286@code{GLU_UNSIGNED_SHORT_1_5_5_5_REV} and @var{format} is neither
287@code{GLU_RGBA} nor @code{GLU_BGRA}.
288
289@code{GLU_INVALID_OPERATION} is returned if @var{type} is
290@code{GLU_UNSIGNED_INT_8_8_8_8} or @code{GLU_UNSIGNED_INT_8_8_8_8_REV}
291and @var{format} is neither @code{GLU_RGBA} nor @code{GLU_BGRA}.
292
293@code{GLU_INVALID_OPERATION} is returned if @var{type} is
294@code{GLU_UNSIGNED_INT_10_10_10_2} or
295@code{GLU_UNSIGNED_INT_2_10_10_10_REV} and @var{format} is neither
296@code{GLU_RGBA} nor @code{GLU_BGRA}.
297
bb894c9d 298@end deftypefun
8925f36f 299
bb894c9d 300@deftypefun GLint gluBuild1DMipmaps target internalFormat width format type data
3c9b6116
AW
301Builds a one-dimensional mipmap.
302
8925f36f
AW
303@table @asis
304@item @var{target}
f37e7e3d 305Specifies the target texture. Must be @code{GLU_TEXTURE_1D}.
8925f36f
AW
306
307@item @var{internalFormat}
f37e7e3d 308Requests the internal storage format of the texture image. The most
8925f36f
AW
309current version of the SGI implementation of GLU does not check this
310value for validity before passing it on to the underlying OpenGL
f37e7e3d
DH
311implementation. A value that is not accepted by the OpenGL
312implementation will lead to an OpenGL error. The benefit of not checking
313this value at the GLU level is that OpenGL extensions can add new
314internal texture formats without requiring a revision of the GLU
315implementation. Older implementations of GLU check this value and raise
8925f36f
AW
316a GLU error if it is not 1, 2, 3, or 4 or one of the following symbolic
317constants: @code{GLU_ALPHA}, @code{GLU_ALPHA4}, @code{GLU_ALPHA8},
318@code{GLU_ALPHA12}, @code{GLU_ALPHA16}, @code{GLU_LUMINANCE},
319@code{GLU_LUMINANCE4}, @code{GLU_LUMINANCE8}, @code{GLU_LUMINANCE12},
320@code{GLU_LUMINANCE16}, @code{GLU_LUMINANCE_ALPHA},
321@code{GLU_LUMINANCE4_ALPHA4}, @code{GLU_LUMINANCE6_ALPHA2},
322@code{GLU_LUMINANCE8_ALPHA8}, @code{GLU_LUMINANCE12_ALPHA4},
323@code{GLU_LUMINANCE12_ALPHA12}, @code{GLU_LUMINANCE16_ALPHA16},
324@code{GLU_INTENSITY}, @code{GLU_INTENSITY4}, @code{GLU_INTENSITY8},
325@code{GLU_INTENSITY12}, @code{GLU_INTENSITY16}, @code{GLU_RGB},
326@code{GLU_R3_G3_B2}, @code{GLU_RGB4}, @code{GLU_RGB5}, @code{GLU_RGB8},
327@code{GLU_RGB10}, @code{GLU_RGB12}, @code{GLU_RGB16}, @code{GLU_RGBA},
328@code{GLU_RGBA2}, @code{GLU_RGBA4}, @code{GLU_RGB5_A1},
329@code{GLU_RGBA8}, @code{GLU_RGB10_A2}, @code{GLU_RGBA12}, or
330@code{GLU_RGBA16}.
331
332@item @var{width}
333Specifies the width, in pixels, of the texture image.
334
335@item @var{format}
f37e7e3d 336Specifies the format of the pixel data. Must be one of
8925f36f
AW
337@code{GLU_COLOR_INDEX}, @code{GLU_DEPTH_COMPONENT}, @code{GLU_RED},
338@code{GLU_GREEN}, @code{GLU_BLUE}, @code{GLU_ALPHA}, @code{GLU_RGB},
339@code{GLU_RGBA}, @code{GLU_BGR}, @code{GLU_BGRA}, @code{GLU_LUMINANCE},
340or @code{GLU_LUMINANCE_ALPHA}.
341
342@item @var{type}
f37e7e3d 343Specifies the data type for @var{data}. Must be one of
8925f36f
AW
344@code{GLU_UNSIGNED_BYTE}, @code{GLU_BYTE}, @code{GLU_BITMAP},
345@code{GLU_UNSIGNED_SHORT}, @code{GLU_SHORT}, @code{GLU_UNSIGNED_INT},
346@code{GLU_INT}, @code{GLU_FLOAT}, @code{GLU_UNSIGNED_BYTE_3_3_2},
347@code{GLU_UNSIGNED_BYTE_2_3_3_REV}, @code{GLU_UNSIGNED_SHORT_5_6_5},
348@code{GLU_UNSIGNED_SHORT_5_6_5_REV}, @code{GLU_UNSIGNED_SHORT_4_4_4_4},
349@code{GLU_UNSIGNED_SHORT_4_4_4_4_REV},
350@code{GLU_UNSIGNED_SHORT_5_5_5_1},
351@code{GLU_UNSIGNED_SHORT_1_5_5_5_REV}, @code{GLU_UNSIGNED_INT_8_8_8_8},
352@code{GLU_UNSIGNED_INT_8_8_8_8_REV}, @code{GLU_UNSIGNED_INT_10_10_10_2},
353or @code{GLU_UNSIGNED_INT_2_10_10_10_REV}.
354
355@item @var{data}
356Specifies a pointer to the image data in memory.
357
358@end table
359
8925f36f 360@code{gluBuild1DMipmaps} builds a series of prefiltered one-dimensional
f37e7e3d
DH
361texture maps of decreasing resolutions called a mipmap. This is used for
362the antialiasing of texture mapped primitives.
8925f36f
AW
363
364A return value of zero indicates success, otherwise a GLU error code is
365returned (see @code{gluErrorString}).
366
367Initially, the @var{width} of @var{data} is checked to see if it is a
f37e7e3d
DH
368power of 2. If not, a copy of @var{data} is scaled up or down to the
369nearest power of 2. (If @var{width} is exactly between powers of 2, then
370the copy of @var{data} will scale upwards.) This copy will be used for
371subsequent mipmapping operations described below. For example, if
8925f36f
AW
372@var{width} is 57, then a copy of @var{data} will scale up to 64 before
373mipmapping takes place.
374
375Then, proxy textures (see @code{glTexImage1D}) are used to determine if
f37e7e3d
DH
376the implementation can fit the requested texture. If not, @var{width} is
377continually halved until it fits.
8925f36f
AW
378
379Next, a series of mipmap levels is built by decimating a copy of
f37e7e3d 380@var{data} in half until size @r{1×1} is reached. At each level, each
8925f36f
AW
381texel in the halved mipmap level is an average of the corresponding two
382texels in the larger mipmap level.
383
f37e7e3d
DH
384@code{glTexImage1D} is called to load each of these mipmap levels. Level
3850 is a copy of @var{data}. The highest level is
386@r{@var{log}_2,⁡(@var{width},)}. For example, if @var{width} is 64 and
3c9b6116
AW
387the implementation can store a texture of this size, the following
388mipmap levels are built: @r{64×1}, @r{32×1}, @r{16×1}, @r{8×1}, @r{4×1},
f37e7e3d 389@r{2×1}, and @r{1×1}. These correspond to levels 0 through 6,
3c9b6116 390respectively.
8925f36f
AW
391
392See the @code{glTexImage1D} reference page for a description of the
f37e7e3d 393acceptable values for the @var{type} parameter. See the
8925f36f
AW
394@code{glDrawPixels} reference page for a description of the acceptable
395values for the @var{data} parameter.
396
8925f36f
AW
397@code{GLU_INVALID_VALUE} is returned if @var{width} is < 1.
398
399@code{GLU_INVALID_ENUM} is returned if @var{format} or @var{type} are
400not legal.
401
402@code{GLU_INVALID_OPERATION} is returned if @var{type} is
403@code{GLU_UNSIGNED_BYTE_3_3_2} or @code{GLU_UNSIGNED_BYTE_2_3_3_REV} and
404@var{format} is not @code{GLU_RGB}.
405
406@code{GLU_INVALID_OPERATION} is returned if @var{type} is
407@code{GLU_UNSIGNED_SHORT_5_6_5} or @code{GLU_UNSIGNED_SHORT_5_6_5_REV}
408and @var{format} is not @code{GLU_RGB}.
409
410@code{GLU_INVALID_OPERATION} is returned if @var{type} is
411@code{GLU_UNSIGNED_SHORT_4_4_4_4} or
412@code{GLU_UNSIGNED_SHORT_4_4_4_4_REV} and @var{format} is neither
413@code{GLU_RGBA} nor @code{GLU_BGRA}.
414
415@code{GLU_INVALID_OPERATION} is returned if @var{type} is
416@code{GLU_UNSIGNED_SHORT_5_5_5_1} or
417@code{GLU_UNSIGNED_SHORT_1_5_5_5_REV} and @var{format} is neither
418@code{GLU_RGBA} nor @code{GLU_BGRA}.
419
420@code{GLU_INVALID_OPERATION} is returned if @var{type} is
421@code{GLU_UNSIGNED_INT_8_8_8_8} or @code{GLU_UNSIGNED_INT_8_8_8_8_REV}
422and @var{format} is neither @code{GLU_RGBA} nor @code{GLU_BGRA}.
423
424@code{GLU_INVALID_OPERATION} is returned if @var{type} is
425@code{GLU_UNSIGNED_INT_10_10_10_2} or
426@code{GLU_UNSIGNED_INT_2_10_10_10_REV} and @var{format} is neither
427@code{GLU_RGBA} nor @code{GLU_BGRA}.
428
bb894c9d 429@end deftypefun
8925f36f 430
bb894c9d 431@deftypefun GLint gluBuild2DMipmapLevels target internalFormat width height format type level base max data
3c9b6116
AW
432Builds a subset of two-dimensional mipmap levels.
433
8925f36f
AW
434@table @asis
435@item @var{target}
f37e7e3d 436Specifies the target texture. Must be @code{GLU_TEXTURE_2D}.
8925f36f
AW
437
438@item @var{internalFormat}
f37e7e3d 439Requests the internal storage format of the texture image. The most
8925f36f
AW
440current version of the SGI implementation of GLU does not check this
441value for validity before passing it on to the underlying OpenGL
f37e7e3d
DH
442implementation. A value that is not accepted by the OpenGL
443implementation will lead to an OpenGL error. The benefit of not checking
444this value at the GLU level is that OpenGL extensions can add new
445internal texture formats without requiring a revision of the GLU
446implementation. Older implementations of GLU check this value and raise
8925f36f
AW
447a GLU error if it is not 1, 2, 3, or 4 or one of the following symbolic
448constants: @code{GLU_ALPHA}, @code{GLU_ALPHA4}, @code{GLU_ALPHA8},
449@code{GLU_ALPHA12}, @code{GLU_ALPHA16}, @code{GLU_LUMINANCE},
450@code{GLU_LUMINANCE4}, @code{GLU_LUMINANCE8}, @code{GLU_LUMINANCE12},
451@code{GLU_LUMINANCE16}, @code{GLU_LUMINANCE_ALPHA},
452@code{GLU_LUMINANCE4_ALPHA4}, @code{GLU_LUMINANCE6_ALPHA2},
453@code{GLU_LUMINANCE8_ALPHA8}, @code{GLU_LUMINANCE12_ALPHA4},
454@code{GLU_LUMINANCE12_ALPHA12}, @code{GLU_LUMINANCE16_ALPHA16},
455@code{GLU_INTENSITY}, @code{GLU_INTENSITY4}, @code{GLU_INTENSITY8},
456@code{GLU_INTENSITY12}, @code{GLU_INTENSITY16}, @code{GLU_RGB},
457@code{GLU_R3_G3_B2}, @code{GLU_RGB4}, @code{GLU_RGB5}, @code{GLU_RGB8},
458@code{GLU_RGB10}, @code{GLU_RGB12}, @code{GLU_RGB16}, @code{GLU_RGBA},
459@code{GLU_RGBA2}, @code{GLU_RGBA4}, @code{GLU_RGB5_A1},
460@code{GLU_RGBA8}, @code{GLU_RGB10_A2}, @code{GLU_RGBA12}, or
461@code{GLU_RGBA16}.
462
463@item @var{width}
464@itemx @var{height}
465Specifies the width and height, respectively, in pixels of the texture
f37e7e3d 466image. These should be a power of 2.
8925f36f
AW
467
468@item @var{format}
f37e7e3d 469Specifies the format of the pixel data. Must be one of
8925f36f
AW
470@code{GLU_COLOR_INDEX}, @code{GLU_DEPTH_COMPONENT}, @code{GLU_RED},
471@code{GLU_GREEN}, @code{GLU_BLUE}, @code{GLU_ALPHA}, @code{GLU_RGB},
472@code{GLU_RGBA}, @code{GLU_BGR}, @code{GLU_BGRA}, @code{GLU_LUMINANCE},
473or @code{GLU_LUMINANCE_ALPHA}.
474
475@item @var{type}
f37e7e3d 476Specifies the data type for @var{data}. Must be one of
8925f36f
AW
477@code{GLU_UNSIGNED_BYTE}, @code{GLU_BYTE}, @code{GLU_BITMAP},
478@code{GLU_UNSIGNED_SHORT}, @code{GLU_SHORT}, @code{GLU_UNSIGNED_INT},
479@code{GLU_INT}, @code{GLU_FLOAT}, @code{GLU_UNSIGNED_BYTE_3_3_2},
480@code{GLU_UNSIGNED_BYTE_2_3_3_REV}, @code{GLU_UNSIGNED_SHORT_5_6_5},
481@code{GLU_UNSIGNED_SHORT_5_6_5_REV}, @code{GLU_UNSIGNED_SHORT_4_4_4_4},
482@code{GLU_UNSIGNED_SHORT_4_4_4_4_REV},
483@code{GLU_UNSIGNED_SHORT_5_5_5_1},
484@code{GLU_UNSIGNED_SHORT_1_5_5_5_REV}, @code{GLU_UNSIGNED_INT_8_8_8_8},
485@code{GLU_UNSIGNED_INT_8_8_8_8_REV}, @code{GLU_UNSIGNED_INT_10_10_10_2},
486or @code{GLU_UNSIGNED_INT_2_10_10_10_REV}.
487
488@item @var{level}
489Specifies the mipmap level of the image data.
490
491@item @var{base}
492Specifies the minimum mipmap level to pass to @code{glTexImage2D}.
493
494@item @var{max}
495Specifies the maximum mipmap level to pass to @code{glTexImage2D}.
496
497@item @var{data}
498Specifies a pointer to the image data in memory.
499
500@end table
501
8925f36f
AW
502@code{gluBuild2DMipmapLevels} builds a subset of prefiltered
503two-dimensional texture maps of decreasing resolutions called a mipmap.
504This is used for the antialiasing of texture mapped primitives.
505
506A return value of zero indicates success, otherwise a GLU error code is
507returned (see @code{gluErrorString}).
508
509A series of mipmap levels from @var{base} to @var{max} is built by
3c9b6116 510decimating @var{data} in half along both dimensions until size @r{1×1}
f37e7e3d
DH
511is reached. At each level, each texel in the halved mipmap level is an
512average of the corresponding four texels in the larger mipmap level. (In
3c9b6116 513the case of rectangular images, the decimation will ultimately reach an
f37e7e3d 514@r{@var{N}×1} or @r{1×@var{N}} configuration. Here, two texels are
3c9b6116 515averaged instead.) @code{glTexImage2D} is called to load these mipmap
f37e7e3d 516levels from @var{base} to @var{max}. If @var{max} is larger than the
3c9b6116
AW
517highest mipmap level for the texture of the specified size, then a GLU
518error code is returned (see @code{gluErrorString}) and nothing is
519loaded.
8925f36f
AW
520
521For example, if @var{level} is 2 and @var{width} is 16 and @var{height}
3c9b6116 522is 8, the following levels are possible: @r{16×8}, @r{8×4}, @r{4×2},
f37e7e3d 523@r{2×1}, @r{1×1}. These correspond to levels 2 through 6 respectively.
3c9b6116 524If @var{base} is 3 and @var{max} is 5, then only mipmap levels @r{8×4},
f37e7e3d 525@r{4×2}, and @r{2×1} are loaded. However, if @var{max} is 7, then an
3c9b6116
AW
526error is returned and nothing is loaded since @var{max} is larger than
527the highest mipmap level which is, in this case, 6.
8925f36f
AW
528
529The highest mipmap level can be derived from the formula
3c9b6116 530@r{@var{log}_2⁡(@var{max}⁡(@var{width},@var{height})×2^@var{level},)}.
8925f36f
AW
531
532See the @code{glTexImage1D} reference page for a description of the
f37e7e3d 533acceptable values for @var{format} parameter. See the
8925f36f
AW
534@code{glDrawPixels} reference page for a description of the acceptable
535values for @var{type} parameter.
536
8925f36f
AW
537@code{GLU_INVALID_VALUE} is returned if @var{level} > @var{base},
538@var{base} < 0, @var{max} < @var{base}, or @var{max} is > the highest
539mipmap level for @var{data}.
540
541@code{GLU_INVALID_VALUE} is returned if @var{width} or @var{height} is <
5421.
543
544@code{GLU_INVALID_ENUM} is returned if @var{internalFormat},
545@var{format}, or @var{type} is not legal.
546
547@code{GLU_INVALID_OPERATION} is returned if @var{type} is
548@code{GLU_UNSIGNED_BYTE_3_3_2} or @code{GLU_UNSIGNED_BYTE_2_3_3_REV} and
549@var{format} is not @code{GLU_RGB}.
550
551@code{GLU_INVALID_OPERATION} is returned if @var{type} is
552@code{GLU_UNSIGNED_SHORT_5_6_5} or @code{GLU_UNSIGNED_SHORT_5_6_5_REV}
553and @var{format} is not @code{GLU_RGB}.
554
555@code{GLU_INVALID_OPERATION} is returned if @var{type} is
556@code{GLU_UNSIGNED_SHORT_4_4_4_4} or
557@code{GLU_UNSIGNED_SHORT_4_4_4_4_REV} and @var{format} is neither
558@code{GLU_RGBA} nor @code{GLU_BGRA}.
559
560@code{GLU_INVALID_OPERATION} is returned if @var{type} is
561@code{GLU_UNSIGNED_SHORT_5_5_5_1} or
562@code{GLU_UNSIGNED_SHORT_1_5_5_5_REV} and @var{format} is neither
563@code{GLU_RGBA} nor @code{GLU_BGRA}.
564
565@code{GLU_INVALID_OPERATION} is returned if @var{type} is
566@code{GLU_UNSIGNED_INT_8_8_8_8} or @code{GLU_UNSIGNED_INT_8_8_8_8_REV}
567and @var{format} is neither @code{GLU_RGBA} nor @code{GLU_BGRA}.
568
569@code{GLU_INVALID_OPERATION} is returned if @var{type} is
570@code{GLU_UNSIGNED_INT_10_10_10_2} or
571@code{GLU_UNSIGNED_INT_2_10_10_10_REV} and @var{format} is neither
572@code{GLU_RGBA} nor @code{GLU_BGRA}.
573
bb894c9d 574@end deftypefun
8925f36f 575
bb894c9d 576@deftypefun GLint gluBuild2DMipmaps target internalFormat width height format type data
3c9b6116
AW
577Builds a two-dimensional mipmap.
578
8925f36f
AW
579@table @asis
580@item @var{target}
f37e7e3d 581Specifies the target texture. Must be @code{GLU_TEXTURE_2D}.
8925f36f
AW
582
583@item @var{internalFormat}
f37e7e3d 584Requests the internal storage format of the texture image. The most
8925f36f
AW
585current version of the SGI implementation of GLU does not check this
586value for validity before passing it on to the underlying OpenGL
f37e7e3d
DH
587implementation. A value that is not accepted by the OpenGL
588implementation will lead to an OpenGL error. The benefit of not checking
589this value at the GLU level is that OpenGL extensions can add new
590internal texture formats without requiring a revision of the GLU
591implementation. Older implementations of GLU check this value and raise
8925f36f
AW
592a GLU error if it is not 1, 2, 3, or 4 or one of the following symbolic
593constants: @code{GLU_ALPHA}, @code{GLU_ALPHA4}, @code{GLU_ALPHA8},
594@code{GLU_ALPHA12}, @code{GLU_ALPHA16}, @code{GLU_LUMINANCE},
595@code{GLU_LUMINANCE4}, @code{GLU_LUMINANCE8}, @code{GLU_LUMINANCE12},
596@code{GLU_LUMINANCE16}, @code{GLU_LUMINANCE_ALPHA},
597@code{GLU_LUMINANCE4_ALPHA4}, @code{GLU_LUMINANCE6_ALPHA2},
598@code{GLU_LUMINANCE8_ALPHA8}, @code{GLU_LUMINANCE12_ALPHA4},
599@code{GLU_LUMINANCE12_ALPHA12}, @code{GLU_LUMINANCE16_ALPHA16},
600@code{GLU_INTENSITY}, @code{GLU_INTENSITY4}, @code{GLU_INTENSITY8},
601@code{GLU_INTENSITY12}, @code{GLU_INTENSITY16}, @code{GLU_RGB},
602@code{GLU_R3_G3_B2}, @code{GLU_RGB4}, @code{GLU_RGB5}, @code{GLU_RGB8},
603@code{GLU_RGB10}, @code{GLU_RGB12}, @code{GLU_RGB16}, @code{GLU_RGBA},
604@code{GLU_RGBA2}, @code{GLU_RGBA4}, @code{GLU_RGB5_A1},
605@code{GLU_RGBA8}, @code{GLU_RGB10_A2}, @code{GLU_RGBA12}, or
606@code{GLU_RGBA16}.
607
608@item @var{width}
609@itemx @var{height}
610Specifies in pixels the width and height, respectively, of the texture
611image.
612
613@item @var{format}
f37e7e3d 614Specifies the format of the pixel data. Must be one of
8925f36f
AW
615@code{GLU_COLOR_INDEX}, @code{GLU_DEPTH_COMPONENT}, @code{GLU_RED},
616@code{GLU_GREEN}, @code{GLU_BLUE}, @code{GLU_ALPHA}, @code{GLU_RGB},
617@code{GLU_RGBA}, @code{GLU_BGR}, @code{GLU_BGRA}, @code{GLU_LUMINANCE},
618or @code{GLU_LUMINANCE_ALPHA}.
619
620@item @var{type}
f37e7e3d 621Specifies the data type for @var{data}. Must be one of
8925f36f
AW
622@code{GLU_UNSIGNED_BYTE}, @code{GLU_BYTE}, @code{GLU_BITMAP},
623@code{GLU_UNSIGNED_SHORT}, @code{GLU_SHORT}, @code{GLU_UNSIGNED_INT},
624@code{GLU_INT}, @code{GLU_FLOAT}, @code{GLU_UNSIGNED_BYTE_3_3_2},
625@code{GLU_UNSIGNED_BYTE_2_3_3_REV}, @code{GLU_UNSIGNED_SHORT_5_6_5},
626@code{GLU_UNSIGNED_SHORT_5_6_5_REV}, @code{GLU_UNSIGNED_SHORT_4_4_4_4},
627@code{GLU_UNSIGNED_SHORT_4_4_4_4_REV},
628@code{GLU_UNSIGNED_SHORT_5_5_5_1},
629@code{GLU_UNSIGNED_SHORT_1_5_5_5_REV}, @code{GLU_UNSIGNED_INT_8_8_8_8},
630@code{GLU_UNSIGNED_INT_8_8_8_8_REV}, @code{GLU_UNSIGNED_INT_10_10_10_2},
631or @code{GLU_UNSIGNED_INT_2_10_10_10_REV}.
632
633@item @var{data}
634Specifies a pointer to the image data in memory.
635
636@end table
637
8925f36f 638@code{gluBuild2DMipmaps} builds a series of prefiltered two-dimensional
f37e7e3d
DH
639texture maps of decreasing resolutions called a mipmap. This is used for
640the antialiasing of texture-mapped primitives.
8925f36f
AW
641
642A return value of zero indicates success, otherwise a GLU error code is
643returned (see @code{gluErrorString}).
644
645Initially, the @var{width} and @var{height} of @var{data} are checked to
f37e7e3d
DH
646see if they are a power of 2. If not, a copy of @var{data} (not
647@var{data}), is scaled up or down to the nearest power of 2. This copy
648will be used for subsequent mipmapping operations described below. (If
8925f36f
AW
649@var{width} or @var{height} is exactly between powers of 2, then the
650copy of @var{data} will scale upwards.) For example, if @var{width} is
65157 and @var{height} is 23, then a copy of @var{data} will scale up to 64
652in @var{width} and down to 16 in depth, before mipmapping takes place.
653
654Then, proxy textures (see @code{glTexImage2D}) are used to determine if
f37e7e3d
DH
655the implementation can fit the requested texture. If not, both
656dimensions are continually halved until it fits. (If the OpenGL version
8925f36f
AW
657is \(<= 1.0, both maximum texture dimensions are clamped to the value
658returned by @code{glGetIntegerv} with the argument
659@code{GLU_MAX_TEXTURE_SIZE}.)
660
661Next, a series of mipmap levels is built by decimating a copy of
3c9b6116
AW
662@var{data} in half along both dimensions until size @r{1×1} is reached.
663At each level, each texel in the halved mipmap level is an average of
f37e7e3d 664the corresponding four texels in the larger mipmap level. (In the case
3c9b6116 665of rectangular images, the decimation will ultimately reach an
f37e7e3d 666@r{@var{N}×1} or @r{1×@var{N}} configuration. Here, two texels are
8925f36f
AW
667averaged instead.)
668
f37e7e3d
DH
669@code{glTexImage2D} is called to load each of these mipmap levels. Level
6700 is a copy of @var{data}. The highest level is
671@r{@var{log}_2,⁡(@var{max}⁡(@var{width},@var{height}),)}. For example,
3c9b6116
AW
672if @var{width} is 64 and @var{height} is 16 and the implementation can
673store a texture of this size, the following mipmap levels are built:
674@r{64×16}, @r{32×8}, @r{16×4}, @r{8×2}, @r{4×1}, @r{2×1}, and @r{1×1}
675These correspond to levels 0 through 6, respectively.
8925f36f
AW
676
677See the @code{glTexImage1D} reference page for a description of the
f37e7e3d 678acceptable values for @var{format} parameter. See the
8925f36f
AW
679@code{glDrawPixels} reference page for a description of the acceptable
680values for @var{type} parameter.
681
8925f36f
AW
682@code{GLU_INVALID_VALUE} is returned if @var{width} or @var{height} is <
6831.
684
685@code{GLU_INVALID_ENUM} is returned if @var{internalFormat},
686@var{format}, or @var{type} is not legal.
687
688@code{GLU_INVALID_OPERATION} is returned if @var{type} is
689@code{GLU_UNSIGNED_BYTE_3_3_2} or @code{GLU_UNSIGNED_BYTE_2_3_3_REV} and
690@var{format} is not @code{GLU_RGB}.
691
692@code{GLU_INVALID_OPERATION} is returned if @var{type} is
693@code{GLU_UNSIGNED_SHORT_5_6_5} or @code{GLU_UNSIGNED_SHORT_5_6_5_REV}
694and @var{format} is not @code{GLU_RGB}.
695
696@code{GLU_INVALID_OPERATION} is returned if @var{type} is
697@code{GLU_UNSIGNED_SHORT_4_4_4_4} or
698@code{GLU_UNSIGNED_SHORT_4_4_4_4_REV} and @var{format} is neither
699@code{GLU_RGBA} nor @code{GLU_BGRA}.
700
701@code{GLU_INVALID_OPERATION} is returned if @var{type} is
702@code{GLU_UNSIGNED_SHORT_5_5_5_1} or
703@code{GLU_UNSIGNED_SHORT_1_5_5_5_REV} and @var{format} is neither
704@code{GLU_RGBA} nor @code{GLU_BGRA}.
705
706@code{GLU_INVALID_OPERATION} is returned if @var{type} is
707@code{GLU_UNSIGNED_INT_8_8_8_8} or @code{GLU_UNSIGNED_INT_8_8_8_8_REV}
708and @var{format} is neither @code{GLU_RGBA} nor @code{GLU_BGRA}.
709
710@code{GLU_INVALID_OPERATION} is returned if @var{type} is
711@code{GLU_UNSIGNED_INT_10_10_10_2} or
712@code{GLU_UNSIGNED_INT_2_10_10_10_REV} and @var{format} is neither
713@code{GLU_RGBA} nor @code{GLU_BGRA}.
714
bb894c9d 715@end deftypefun
8925f36f 716
bb894c9d 717@deftypefun GLint gluBuild3DMipmapLevels target internalFormat width height depth format type level base max data
3c9b6116
AW
718Builds a subset of three-dimensional mipmap levels.
719
8925f36f
AW
720@table @asis
721@item @var{target}
f37e7e3d 722Specifies the target texture. Must be @code{GLU_TEXTURE_3D}.
8925f36f
AW
723
724@item @var{internalFormat}
f37e7e3d 725Requests the internal storage format of the texture image. The most
8925f36f
AW
726current version of the SGI implementation of GLU does not check this
727value for validity before passing it on to the underlying OpenGL
f37e7e3d
DH
728implementation. A value that is not accepted by the OpenGL
729implementation will lead to an OpenGL error. The benefit of not checking
730this value at the GLU level is that OpenGL extensions can add new
731internal texture formats without requiring a revision of the GLU
732implementation. Older implementations of GLU check this value and raise
8925f36f
AW
733a GLU error if it is not 1, 2, 3, or 4 or one of the following symbolic
734constants: @code{GLU_ALPHA}, @code{GLU_ALPHA4}, @code{GLU_ALPHA8},
735@code{GLU_ALPHA12}, @code{GLU_ALPHA16}, @code{GLU_LUMINANCE},
736@code{GLU_LUMINANCE4}, @code{GLU_LUMINANCE8}, @code{GLU_LUMINANCE12},
737@code{GLU_LUMINANCE16}, @code{GLU_LUMINANCE_ALPHA},
738@code{GLU_LUMINANCE4_ALPHA4}, @code{GLU_LUMINANCE6_ALPHA2},
739@code{GLU_LUMINANCE8_ALPHA8}, @code{GLU_LUMINANCE12_ALPHA4},
740@code{GLU_LUMINANCE12_ALPHA12}, @code{GLU_LUMINANCE16_ALPHA16},
741@code{GLU_INTENSITY}, @code{GLU_INTENSITY4}, @code{GLU_INTENSITY8},
742@code{GLU_INTENSITY12}, @code{GLU_INTENSITY16}, @code{GLU_RGB},
743@code{GLU_R3_G3_B2}, @code{GLU_RGB4}, @code{GLU_RGB5}, @code{GLU_RGB8},
744@code{GLU_RGB10}, @code{GLU_RGB12}, @code{GLU_RGB16}, @code{GLU_RGBA},
745@code{GLU_RGBA2}, @code{GLU_RGBA4}, @code{GLU_RGB5_A1},
746@code{GLU_RGBA8}, @code{GLU_RGB10_A2}, @code{GLU_RGBA12}, or
747@code{GLU_RGBA16}.
748
749@item @var{width}
750@itemx @var{height}
751@itemx @var{depth}
752Specifies in pixels the width, height and depth respectively, of the
f37e7e3d 753texture image. These should be a power of 2.
8925f36f
AW
754
755@item @var{format}
f37e7e3d 756Specifies the format of the pixel data. Must be one of
8925f36f
AW
757@code{GLU_COLOR_INDEX}, @code{GLU_DEPTH_COMPONENT}, @code{GLU_RED},
758@code{GLU_GREEN}, @code{GLU_BLUE}, @code{GLU_ALPHA}, @code{GLU_RGB},
759@code{GLU_RGBA}, @code{GLU_BGR}, @code{GLU_BGRA}, @code{GLU_LUMINANCE},
760or @code{GLU_LUMINANCE_ALPHA}.
761
762@item @var{type}
f37e7e3d 763Specifies the data type for @var{data}. Must be one of
8925f36f
AW
764@code{GLU_UNSIGNED_BYTE}, @code{GLU_BYTE}, @code{GLU_BITMAP},
765@code{GLU_UNSIGNED_SHORT}, @code{GLU_SHORT}, @code{GLU_UNSIGNED_INT},
766@code{GLU_INT}, @code{GLU_FLOAT}, @code{GLU_UNSIGNED_BYTE_3_3_2},
767@code{GLU_UNSIGNED_BYTE_2_3_3_REV}, @code{GLU_UNSIGNED_SHORT_5_6_5},
768@code{GLU_UNSIGNED_SHORT_5_6_5_REV}, @code{GLU_UNSIGNED_SHORT_4_4_4_4},
769@code{GLU_UNSIGNED_SHORT_4_4_4_4_REV},
770@code{GLU_UNSIGNED_SHORT_5_5_5_1},
771@code{GLU_UNSIGNED_SHORT_1_5_5_5_REV}, @code{GLU_UNSIGNED_INT_8_8_8_8},
772@code{GLU_UNSIGNED_INT_8_8_8_8_REV}, @code{GLU_UNSIGNED_INT_10_10_10_2},
773or @code{GLU_UNSIGNED_INT_2_10_10_10_REV}.
774
775@item @var{level}
776Specifies the mipmap level of the image data.
777
778@item @var{base}
779Specifies the minimum mipmap level to pass to @code{glTexImage3D}.
780
781@item @var{max}
782Specifies the maximum mipmap level to pass to @code{glTexImage3D}.
783
784@item @var{data}
785Specifies a pointer to the image data in memory.
786
787@end table
788
8925f36f
AW
789@code{gluBuild3DMipmapLevels} builds a subset of prefiltered
790three-dimensional texture maps of decreasing resolutions called a
f37e7e3d 791mipmap. This is used for the antialiasing of texture mapped primitives.
8925f36f
AW
792
793A return value of zero indicates success, otherwise a GLU error code is
794returned (see @code{gluErrorString}).
795
796A series of mipmap levels from @var{base} to @var{max} is built by
3c9b6116 797decimating @var{data} in half along both dimensions until size @r{1×1×1}
f37e7e3d 798is reached. At each level, each texel in the halved mipmap level is an
3c9b6116 799average of the corresponding eight texels in the larger mipmap level.
f37e7e3d 800(If exactly one of the dimensions is 1, four texels are averaged. If
3c9b6116
AW
801exactly two of the dimensions are 1, two texels are averaged.)
802@code{glTexImage3D} is called to load these mipmap levels from
f37e7e3d 803@var{base} to @var{max}. If @var{max} is larger than the highest mipmap
3c9b6116
AW
804level for the texture of the specified size, then a GLU error code is
805returned (see @code{gluErrorString}) and nothing is loaded.
8925f36f
AW
806
807For example, if @var{level} is 2 and @var{width} is 16, @var{height} is
3c9b6116 8088 and @var{depth} is 4, the following levels are possible: @r{16×8×4},
f37e7e3d
DH
809@r{8×4×2}, @r{4×2×1}, @r{2×1×1}, @r{1×1×1}. These correspond to levels 2
810through 6 respectively. If @var{base} is 3 and @var{max} is 5, then only
811mipmap levels @r{8×4×2}, @r{4×2×1}, and @r{2×1×1} are loaded. However,
812if @var{max} is 7, then an error is returned and nothing is loaded,
813since @var{max} is larger than the highest mipmap level which is, in
814this case, 6.
8925f36f
AW
815
816The highest mipmap level can be derived from the formula
3c9b6116 817@r{@var{log}_2⁡(@var{max}⁡(@var{width},@var{height}@var{depth})×2^@var{level},)}.
8925f36f
AW
818
819See the @code{glTexImage1D} reference page for a description of the
f37e7e3d 820acceptable values for @var{format} parameter. See the
8925f36f
AW
821@code{glDrawPixels} reference page for a description of the acceptable
822values for @var{type} parameter.
823
8925f36f
AW
824@code{GLU_INVALID_VALUE} is returned if @var{level} > @var{base},
825@var{base} < 0, @var{max} < @var{base}, or @var{max} is > the highest
826mipmap level for @var{data}.
827
828@code{GLU_INVALID_VALUE} is returned if @var{width}, @var{height}, or
829@var{depth} is < 1.
830
831@code{GLU_INVALID_ENUM} is returned if @var{internalFormat},
832@var{format}, or @var{type} is not legal.
833
834@code{GLU_INVALID_OPERATION} is returned if @var{type} is
835@code{GLU_UNSIGNED_BYTE_3_3_2} or @code{GLU_UNSIGNED_BYTE_2_3_3_REV} and
836@var{format} is not @code{GLU_RGB}.
837
838@code{GLU_INVALID_OPERATION} is returned if @var{type} is
839@code{GLU_UNSIGNED_SHORT_5_6_5} or @code{GLU_UNSIGNED_SHORT_5_6_5_REV}
840and @var{format} is not @code{GLU_RGB}.
841
842@code{GLU_INVALID_OPERATION} is returned if @var{type} is
843@code{GLU_UNSIGNED_SHORT_4_4_4_4} or
844@code{GLU_UNSIGNED_SHORT_4_4_4_4_REV} and @var{format} is neither
845@code{GLU_RGBA} nor @code{GLU_BGRA}.
846
847@code{GLU_INVALID_OPERATION} is returned if @var{type} is
848@code{GLU_UNSIGNED_SHORT_5_5_5_1} or
849@code{GLU_UNSIGNED_SHORT_1_5_5_5_REV} and @var{format} is neither
850@code{GLU_RGBA} nor @code{GLU_BGRA}.
851
852@code{GLU_INVALID_OPERATION} is returned if @var{type} is
853@code{GLU_UNSIGNED_INT_8_8_8_8} or @code{GLU_UNSIGNED_INT_8_8_8_8_REV}
854and @var{format} is neither @code{GLU_RGBA} nor @code{GLU_BGRA}.
855
856@code{GLU_INVALID_OPERATION} is returned if @var{type} is
857@code{GLU_UNSIGNED_INT_10_10_10_2} or
858@code{GLU_UNSIGNED_INT_2_10_10_10_REV} and @var{format} is neither
859@code{GLU_RGBA} nor @code{GLU_BGRA}.
860
bb894c9d 861@end deftypefun
8925f36f 862
bb894c9d 863@deftypefun GLint gluBuild3DMipmaps target internalFormat width height depth format type data
3c9b6116
AW
864Builds a three-dimensional mipmap.
865
8925f36f
AW
866@table @asis
867@item @var{target}
f37e7e3d 868Specifies the target texture. Must be @code{GLU_TEXTURE_3D}.
8925f36f
AW
869
870@item @var{internalFormat}
f37e7e3d 871Requests the internal storage format of the texture image. The most
8925f36f
AW
872current version of the SGI implementation of GLU does not check this
873value for validity before passing it on to the underlying OpenGL
f37e7e3d
DH
874implementation. A value that is not accepted by the OpenGL
875implementation will lead to an OpenGL error. The benefit of not checking
876this value at the GLU level is that OpenGL extensions can add new
877internal texture formats without requiring a revision of the GLU
878implementation. Older implementations of GLU check this value and raise
8925f36f
AW
879a GLU error if it is not 1, 2, 3, or 4 or one of the following symbolic
880constants: @code{GLU_ALPHA}, @code{GLU_ALPHA4}, @code{GLU_ALPHA8},
881@code{GLU_ALPHA12}, @code{GLU_ALPHA16}, @code{GLU_LUMINANCE},
882@code{GLU_LUMINANCE4}, @code{GLU_LUMINANCE8}, @code{GLU_LUMINANCE12},
883@code{GLU_LUMINANCE16}, @code{GLU_LUMINANCE_ALPHA},
884@code{GLU_LUMINANCE4_ALPHA4}, @code{GLU_LUMINANCE6_ALPHA2},
885@code{GLU_LUMINANCE8_ALPHA8}, @code{GLU_LUMINANCE12_ALPHA4},
886@code{GLU_LUMINANCE12_ALPHA12}, @code{GLU_LUMINANCE16_ALPHA16},
887@code{GLU_INTENSITY}, @code{GLU_INTENSITY4}, @code{GLU_INTENSITY8},
888@code{GLU_INTENSITY12}, @code{GLU_INTENSITY16}, @code{GLU_RGB},
889@code{GLU_R3_G3_B2}, @code{GLU_RGB4}, @code{GLU_RGB5}, @code{GLU_RGB8},
890@code{GLU_RGB10}, @code{GLU_RGB12}, @code{GLU_RGB16}, @code{GLU_RGBA},
891@code{GLU_RGBA2}, @code{GLU_RGBA4}, @code{GLU_RGB5_A1},
892@code{GLU_RGBA8}, @code{GLU_RGB10_A2}, @code{GLU_RGBA12}, or
893@code{GLU_RGBA16}.
894
895@item @var{width}
896@itemx @var{height}
897@itemx @var{depth}
898Specifies in pixels the width, height and depth respectively, in pixels
899of the texture image.
900
901@item @var{format}
f37e7e3d 902Specifies the format of the pixel data. Must be one of
8925f36f
AW
903@code{GLU_COLOR_INDEX}, @code{GLU_DEPTH_COMPONENT}, @code{GLU_RED},
904@code{GLU_GREEN}, @code{GLU_BLUE}, @code{GLU_ALPHA}, @code{GLU_RGB},
905@code{GLU_RGBA}, @code{GLU_BGR}, @code{GLU_BGRA}, @code{GLU_LUMINANCE},
906or @code{GLU_LUMINANCE_ALPHA}.
907
908@item @var{type}
f37e7e3d 909Specifies the data type for @var{data}. Must be one of:
8925f36f
AW
910@code{GLU_UNSIGNED_BYTE}, @code{GLU_BYTE}, @code{GLU_BITMAP},
911@code{GLU_UNSIGNED_SHORT}, @code{GLU_SHORT}, @code{GLU_UNSIGNED_INT},
912@code{GLU_INT}, @code{GLU_FLOAT}, @code{GLU_UNSIGNED_BYTE_3_3_2},
913@code{GLU_UNSIGNED_BYTE_2_3_3_REV}, @code{GLU_UNSIGNED_SHORT_5_6_5},
914@code{GLU_UNSIGNED_SHORT_5_6_5_REV}, @code{GLU_UNSIGNED_SHORT_4_4_4_4},
915@code{GLU_UNSIGNED_SHORT_4_4_4_4_REV},
916@code{GLU_UNSIGNED_SHORT_5_5_5_1},
917@code{GLU_UNSIGNED_SHORT_1_5_5_5_REV}, @code{GLU_UNSIGNED_INT_8_8_8_8},
918@code{GLU_UNSIGNED_INT_8_8_8_8_REV}, @code{GLU_UNSIGNED_INT_10_10_10_2},
919or @code{GLU_UNSIGNED_INT_2_10_10_10_REV}.
920
921@item @var{data}
922Specifies a pointer to the image data in memory.
923
924@end table
925
8925f36f
AW
926@code{gluBuild3DMipmaps} builds a series of prefiltered
927three-dimensional texture maps of decreasing resolutions called a
f37e7e3d 928mipmap. This is used for the antialiasing of texture-mapped primitives.
8925f36f
AW
929
930A return value of zero indicates success, otherwise a GLU error code is
931returned (see @code{gluErrorString}).
932
933Initially, the @var{width}, @var{height} and @var{depth} of @var{data}
f37e7e3d
DH
934are checked to see if they are a power of 2. If not, a copy of
935@var{data} is made and scaled up or down to the nearest power of 2. (If
8925f36f
AW
936@var{width}, @var{height}, or @var{depth} is exactly between powers of
9372, then the copy of @var{data} will scale upwards.) This copy will be
f37e7e3d 938used for subsequent mipmapping operations described below. For example,
8925f36f
AW
939if @var{width} is 57, @var{height} is 23, and @var{depth} is 24, then a
940copy of @var{data} will scale up to 64 in width, down to 16 in height,
941and up to 32 in depth before mipmapping takes place.
942
943Then, proxy textures (see @code{glTexImage3D}) are used to determine if
f37e7e3d 944the implementation can fit the requested texture. If not, all three
8925f36f
AW
945dimensions are continually halved until it fits.
946
947Next, a series of mipmap levels is built by decimating a copy of
3c9b6116 948@var{data} in half along all three dimensions until size @r{1×1×1} is
f37e7e3d 949reached. At each level, each texel in the halved mipmap level is an
8925f36f 950average of the corresponding eight texels in the larger mipmap level.
f37e7e3d 951(If exactly one of the dimensions is 1, four texels are averaged. If
8925f36f
AW
952exactly two of the dimensions are 1, two texels are averaged.)
953
f37e7e3d
DH
954@code{glTexImage3D} is called to load each of these mipmap levels. Level
9550 is a copy of @var{data}. The highest level is
956@r{@var{log}_2,⁡(@var{max}⁡(@var{width},@var{height}@var{depth}),)}. For
3c9b6116
AW
957example, if @var{width} is 64, @var{height} is 16, and @var{depth} is
95832, and the implementation can store a texture of this size, the
959following mipmap levels are built: @r{64×16×32}, @r{32×8×16},
f37e7e3d 960@r{16×4×8}, @r{8×2×4}, @r{4×1×2}, @r{2×1×1}, and @r{1×1×1}. These
3c9b6116 961correspond to levels 0 through 6, respectively.
8925f36f
AW
962
963See the @code{glTexImage1D} reference page for a description of the
f37e7e3d 964acceptable values for @var{format} parameter. See the
8925f36f
AW
965@code{glDrawPixels} reference page for a description of the acceptable
966values for @var{type} parameter.
967
8925f36f
AW
968@code{GLU_INVALID_VALUE} is returned if @var{width}, @var{height}, or
969@var{depth} is < 1.
970
971@code{GLU_INVALID_ENUM} is returned if @var{internalFormat},
972@var{format}, or @var{type} is not legal.
973
974@code{GLU_INVALID_OPERATION} is returned if @var{type} is
975@code{GLU_UNSIGNED_BYTE_3_3_2} or @code{GLU_UNSIGNED_BYTE_2_3_3_REV} and
976@var{format} is not @code{GLU_RGB}.
977
978@code{GLU_INVALID_OPERATION} is returned if @var{type} is
979@code{GLU_UNSIGNED_SHORT_5_6_5} or @code{GLU_UNSIGNED_SHORT_5_6_5_REV}
980and @var{format} is not @code{GLU_RGB}.
981
982@code{GLU_INVALID_OPERATION} is returned if @var{type} is
983@code{GLU_UNSIGNED_SHORT_4_4_4_4} or
984@code{GLU_UNSIGNED_SHORT_4_4_4_4_REV} and @var{format} is neither
985@code{GLU_RGBA} nor @code{GLU_BGRA}.
986
987@code{GLU_INVALID_OPERATION} is returned if @var{type} is
988@code{GLU_UNSIGNED_SHORT_5_5_5_1} or
989@code{GLU_UNSIGNED_SHORT_1_5_5_5_REV} and @var{format} is neither
990@code{GLU_RGBA} nor @code{GLU_BGRA}.
991
992@code{GLU_INVALID_OPERATION} is returned if @var{type} is
993@code{GLU_UNSIGNED_INT_8_8_8_8} or @code{GLU_UNSIGNED_INT_8_8_8_8_REV}
994and @var{format} is neither @code{GLU_RGBA} nor @code{GLU_BGRA}.
995
996@code{GLU_INVALID_OPERATION} is returned if @var{type} is
997@code{GLU_UNSIGNED_INT_10_10_10_2} or
998@code{GLU_UNSIGNED_INT_2_10_10_10_REV} and @var{format} is neither
999@code{GLU_RGBA} nor @code{GLU_BGRA}.
1000
bb894c9d 1001@end deftypefun
8925f36f 1002
bb894c9d 1003@deftypefun GLboolean gluCheckExtension extName extString
3c9b6116
AW
1004Determines if an extension name is supported.
1005
8925f36f
AW
1006@table @asis
1007@item @var{extName}
1008Specifies an extension name.
1009
1010@item @var{extString}
1011Specifies a space-separated list of extension names supported.
1012
1013@end table
1014
8925f36f
AW
1015@code{gluCheckExtension} returns @code{GLU_TRUE} if @var{extName} is
1016supported otherwise @code{GLU_FALSE} is returned.
1017
1018This is used to check for the presence for OpenGL, GLU, or GLX extension
1019names by passing the extension strings returned by @code{glGetString},
1020@code{gluGetString}, @code{glXGetClientString},
1021@code{glXQueryExtensionsString}, or @code{glXQueryServerString},
1022respectively, as @var{extString}.
1023
bb894c9d 1024@end deftypefun
8925f36f 1025
bb894c9d 1026@deftypefun void gluCylinder quad base top height slices stacks
3c9b6116
AW
1027Draw a cylinder.
1028
8925f36f
AW
1029@table @asis
1030@item @var{quad}
1031Specifies the quadrics object (created with @code{gluNewQuadric}).
1032
1033@item @var{base}
1034Specifies the radius of the cylinder at @var{z} = 0.
1035
1036@item @var{top}
1037Specifies the radius of the cylinder at @var{z} = @var{height}.
1038
1039@item @var{height}
1040Specifies the height of the cylinder.
1041
1042@item @var{slices}
1043Specifies the number of subdivisions around the @var{z} axis.
1044
1045@item @var{stacks}
1046Specifies the number of subdivisions along the @var{z} axis.
1047
1048@end table
1049
f37e7e3d 1050@code{gluCylinder} draws a cylinder oriented along the @var{z} axis. The
8925f36f 1051base of the cylinder is placed at @var{z} = 0 and the top at
f37e7e3d
DH
1052@r{@var{z}=@var{height}}. Like a sphere, a cylinder is subdivided around
1053the @var{z} axis into slices and along the @var{z} axis into stacks.
8925f36f
AW
1054
1055Note that if @var{top} is set to 0.0, this routine generates a cone.
1056
1057If the orientation is set to @code{GLU_OUTSIDE} (with
1058@code{gluQuadricOrientation}), then any generated normals point away
f37e7e3d 1059from the @var{z} axis. Otherwise, they point toward the @var{z} axis.
8925f36f
AW
1060
1061If texturing is turned on (with @code{gluQuadricTexture}), then texture
1062coordinates are generated so that @var{t} ranges linearly from 0.0 at
1063@var{z} = 0 to 1.0 at @var{z} = @var{height}, and @var{s} ranges from
10640.0 at the +@var{y} axis, to 0.25 at the +@var{x} axis, to 0.5 at the
1065-@var{y} axis, to 0.75 at the \-@var{x} axis, and back to 1.0 at the
1066+@var{y} axis.
1067
bb894c9d 1068@end deftypefun
8925f36f 1069
bb894c9d 1070@deftypefun void gluDeleteNurbsRenderer nurb
3c9b6116
AW
1071Destroy a NURBS object.
1072
8925f36f
AW
1073@table @asis
1074@item @var{nurb}
1075Specifies the NURBS object to be destroyed.
1076
1077@end table
1078
8925f36f
AW
1079@code{gluDeleteNurbsRenderer} destroys the NURBS object (which was
1080created with @code{gluNewNurbsRenderer}) and frees any memory it uses.
1081Once @code{gluDeleteNurbsRenderer} has been called, @var{nurb} cannot be
1082used again.
1083
bb894c9d 1084@end deftypefun
8925f36f 1085
bb894c9d 1086@deftypefun void gluDeleteQuadric quad
3c9b6116
AW
1087Destroy a quadrics object.
1088
8925f36f
AW
1089@table @asis
1090@item @var{quad}
1091Specifies the quadrics object to be destroyed.
1092
1093@end table
1094
8925f36f 1095@code{gluDeleteQuadric} destroys the quadrics object (created with
f37e7e3d 1096@code{gluNewQuadric}) and frees any memory it uses. Once
8925f36f
AW
1097@code{gluDeleteQuadric} has been called, @var{quad} cannot be used
1098again.
1099
bb894c9d 1100@end deftypefun
8925f36f 1101
bb894c9d 1102@deftypefun void gluDeleteTess tess
3c9b6116
AW
1103Destroy a tessellation object.
1104
8925f36f
AW
1105@table @asis
1106@item @var{tess}
1107Specifies the tessellation object to destroy.
1108
1109@end table
1110
8925f36f
AW
1111@code{gluDeleteTess} destroys the indicated tessellation object (which
1112was created with @code{gluNewTess}) and frees any memory that it used.
1113
bb894c9d 1114@end deftypefun
8925f36f 1115
bb894c9d 1116@deftypefun void gluDisk quad inner outer slices loops
3c9b6116
AW
1117Draw a disk.
1118
8925f36f
AW
1119@table @asis
1120@item @var{quad}
1121Specifies the quadrics object (created with @code{gluNewQuadric}).
1122
1123@item @var{inner}
1124Specifies the inner radius of the disk (may be 0).
1125
1126@item @var{outer}
1127Specifies the outer radius of the disk.
1128
1129@item @var{slices}
1130Specifies the number of subdivisions around the @var{z} axis.
1131
1132@item @var{loops}
1133Specifies the number of concentric rings about the origin into which the
1134disk is subdivided.
1135
1136@end table
1137
f37e7e3d 1138@code{gluDisk} renders a disk on the @var{z} = 0 plane. The disk has a
8925f36f 1139radius of @var{outer} and contains a concentric circular hole with a
f37e7e3d 1140radius of @var{inner}. If @var{inner} is 0, then no hole is generated.
8925f36f
AW
1141The disk is subdivided around the @var{z} axis into slices (like pizza
1142slices) and also about the @var{z} axis into rings (as specified by
1143@var{slices} and @var{loops}, respectively).
1144
1145With respect to orientation, the +@var{z} side of the disk is considered
f37e7e3d
DH
1146to be ``outside'' (see @code{gluQuadricOrientation}). This means that if
1147the orientation is set to @code{GLU_OUTSIDE}, then any normals generated
1148point along the +@var{z} axis. Otherwise, they point along the \-@var{z}
1149axis.
8925f36f
AW
1150
1151If texturing has been turned on (with @code{gluQuadricTexture}), texture
1152coordinates are generated linearly such that where
3c9b6116 1153@r{@var{r}=@var{outer}}, the value at (@var{r}, 0, 0) is (1, 0.5), at
8925f36f
AW
1154(0, @var{r}, 0) it is (0.5, 1), at (\-@var{r}, 0, 0) it is (0, 0.5), and
1155at (0, \-@var{r}, 0) it is (0.5, 0).
1156
bb894c9d 1157@end deftypefun
8925f36f 1158
00239761 1159@deftypefun const-GLubyte-* gluErrorString error
3c9b6116
AW
1160Produce an error string from a GL or GLU error code.
1161
8925f36f
AW
1162@table @asis
1163@item @var{error}
1164Specifies a GL or GLU error code.
1165
1166@end table
1167
8925f36f 1168@code{gluErrorString} produces an error string from a GL or GLU error
f37e7e3d 1169code. The string is in ISO Latin 1 format. For example,
8925f36f
AW
1170@code{gluErrorString}(@code{GLU_OUT_OF_MEMORY}) returns the string
1171@var{out of memory}.
1172
1173The standard GLU error codes are @code{GLU_INVALID_ENUM},
f37e7e3d
DH
1174@code{GLU_INVALID_VALUE}, and @code{GLU_OUT_OF_MEMORY}. Certain other
1175GLU functions can return specialized error codes through callbacks. See
8925f36f
AW
1176the @code{glGetError} reference page for the list of GL error codes.
1177
8925f36f
AW
1178@code{NULL} is returned if @var{error} is not a valid GL or GLU error
1179code.
1180
bb894c9d 1181@end deftypefun
8925f36f 1182
bb894c9d 1183@deftypefun void gluGetNurbsProperty nurb property data
3c9b6116
AW
1184Get a NURBS property.
1185
8925f36f
AW
1186@table @asis
1187@item @var{nurb}
1188Specifies the NURBS object (created with @code{gluNewNurbsRenderer}).
1189
1190@item @var{property}
f37e7e3d 1191Specifies the property whose value is to be fetched. Valid values are
8925f36f
AW
1192@code{GLU_CULLING}, @code{GLU_SAMPLING_TOLERANCE},
1193@code{GLU_DISPLAY_MODE}, @code{GLU_AUTO_LOAD_MATRIX},
1194@code{GLU_PARAMETRIC_TOLERANCE}, @code{GLU_SAMPLING_METHOD},
1195@code{GLU_U_STEP}, @code{GLU_V_STEP}, and @code{GLU_NURBS_MODE}.
1196
1197@item @var{data}
1198Specifies a pointer to the location into which the value of the named
1199property is written.
1200
1201@end table
1202
8925f36f 1203@code{gluGetNurbsProperty} retrieves properties stored in a NURBS
f37e7e3d
DH
1204object. These properties affect the way that NURBS curves and surfaces
1205are rendered. See the @code{gluNurbsProperty} reference page for
8925f36f
AW
1206information about what the properties are and what they do.
1207
bb894c9d 1208@end deftypefun
8925f36f 1209
00239761 1210@deftypefun const-GLubyte-* gluGetString name
3c9b6116
AW
1211Return a string describing the GLU version or GLU extensions .
1212
8925f36f
AW
1213@table @asis
1214@item @var{name}
1215Specifies a symbolic constant, one of @code{GLU_VERSION}, or
1216@code{GLU_EXTENSIONS}.
1217
1218@end table
1219
8925f36f
AW
1220@code{gluGetString} returns a pointer to a static string describing the
1221GLU version or the GLU extensions that are supported.
1222
1223The version number is one of the following forms:
1224
1225@var{major_number.minor_number}@var{major_number.minor_number.release_number}.
1226
1227The version string is of the following form:
1228
1229@var{version number<space>vendor-specific information}
1230
f37e7e3d 1231Vendor-specific information is optional. Its format and contents depend
8925f36f
AW
1232on the implementation.
1233
f37e7e3d
DH
1234The standard GLU contains a basic set of features and capabilities. If a
1235company or group of companies wish to support other features, these may
1236be included as extensions to the GLU. If @var{name} is
8925f36f 1237@code{GLU_EXTENSIONS}, then @code{gluGetString} returns a
f37e7e3d 1238space-separated list of names of supported GLU extensions. (Extension
8925f36f
AW
1239names never contain spaces.)
1240
1241All strings are null-terminated.
1242
8925f36f
AW
1243NULL is returned if @var{name} is not @code{GLU_VERSION} or
1244@code{GLU_EXTENSIONS}.
1245
1246
1247
bb894c9d 1248@end deftypefun
8925f36f 1249
bb894c9d 1250@deftypefun void gluGetTessProperty tess which data
3c9b6116
AW
1251Get a tessellation object property.
1252
8925f36f
AW
1253@table @asis
1254@item @var{tess}
1255Specifies the tessellation object (created with @code{gluNewTess}).
1256
1257@item @var{which}
f37e7e3d 1258Specifies the property whose value is to be fetched. Valid values are
8925f36f
AW
1259@code{GLU_TESS_WINDING_RULE}, @code{GLU_TESS_BOUNDARY_ONLY}, and
1260@code{GLU_TESS_TOLERANCE}.
1261
1262@item @var{data}
1263Specifies a pointer to the location into which the value of the named
1264property is written.
1265
1266@end table
1267
8925f36f 1268@code{gluGetTessProperty} retrieves properties stored in a tessellation
f37e7e3d
DH
1269object. These properties affect the way that tessellation objects are
1270interpreted and rendered. See the @code{gluTessProperty} reference page
8925f36f
AW
1271for information about the properties and what they do.
1272
bb894c9d 1273@end deftypefun
8925f36f 1274
bb894c9d 1275@deftypefun void gluLoadSamplingMatrices nurb model perspective view
3c9b6116
AW
1276Load NURBS sampling and culling matrices.
1277
8925f36f
AW
1278@table @asis
1279@item @var{nurb}
1280Specifies the NURBS object (created with @code{gluNewNurbsRenderer}).
1281
1282@item @var{model}
1283Specifies a modelview matrix (as from a @code{glGetFloatv} call).
1284
1285@item @var{perspective}
1286Specifies a projection matrix (as from a @code{glGetFloatv} call).
1287
1288@item @var{view}
1289Specifies a viewport (as from a @code{glGetIntegerv} call).
1290
1291@end table
1292
8925f36f
AW
1293@code{gluLoadSamplingMatrices} uses @var{model}, @var{perspective}, and
1294@var{view} to recompute the sampling and culling matrices stored in
f37e7e3d 1295@var{nurb}. The sampling matrix determines how finely a NURBS curve or
8925f36f 1296surface must be tessellated to satisfy the sampling tolerance (as
f37e7e3d 1297determined by the @code{GLU_SAMPLING_TOLERANCE} property). The culling
8925f36f
AW
1298matrix is used in deciding if a NURBS curve or surface should be culled
1299before rendering (when the @code{GLU_CULLING} property is turned on).
1300
1301@code{gluLoadSamplingMatrices} is necessary only if the
1302@code{GLU_AUTO_LOAD_MATRIX} property is turned off (see
f37e7e3d 1303@code{gluNurbsProperty}). Although it can be convenient to leave the
8925f36f 1304@code{GLU_AUTO_LOAD_MATRIX} property turned on, there can be a
f37e7e3d 1305performance penalty for doing so. (A round trip to the GL server is
8925f36f
AW
1306needed to fetch the current values of the modelview matrix, projection
1307matrix, and viewport.)
1308
bb894c9d 1309@end deftypefun
8925f36f 1310
bb894c9d 1311@deftypefun void gluLookAt eyeX eyeY eyeZ centerX centerY centerZ upX upY upZ
3c9b6116
AW
1312Define a viewing transformation.
1313
8925f36f
AW
1314@table @asis
1315@item @var{eyeX}
1316@itemx @var{eyeY}
1317@itemx @var{eyeZ}
1318Specifies the position of the eye point.
1319
1320@item @var{centerX}
1321@itemx @var{centerY}
1322@itemx @var{centerZ}
1323Specifies the position of the reference point.
1324
1325@item @var{upX}
1326@itemx @var{upY}
1327@itemx @var{upZ}
1328Specifies the direction of the @var{up} vector.
1329
1330@end table
1331
8925f36f
AW
1332@code{gluLookAt} creates a viewing matrix derived from an eye point, a
1333reference point indicating the center of the scene, and an @var{UP}
1334vector.
1335
1336The matrix maps the reference point to the negative @var{z} axis and the
f37e7e3d 1337eye point to the origin. When a typical projection matrix is used, the
8925f36f
AW
1338center of the scene therefore maps to the center of the viewport.
1339Similarly, the direction described by the @var{UP} vector projected onto
1340the viewing plane is mapped to the positive @var{y} axis so that it
f37e7e3d 1341points upward in the viewport. The @var{UP} vector must not be parallel
8925f36f
AW
1342to the line of sight from the eye point to the reference point.
1343
1344Let
1345
3c9b6116 1346@r{@var{F}=((@var{centerX}-@var{eyeX}), (@var{centerY}-@var{eyeY}),
8925f36f
AW
1347(@var{centerZ}-@var{eyeZ}),)}
1348
1349
1350
3c9b6116 1351Let @var{UP} be the vector @r{(@var{upX},@var{upY}@var{upZ})}.
8925f36f 1352
3c9b6116 1353Then normalize as follows: @r{@var{f}=@var{F}/∥@var{F},∥,}
8925f36f 1354
3c9b6116 1355@r{@var{UP}^″=@var{UP}/∥@var{UP},∥,}
8925f36f
AW
1356
1357
1358
3c9b6116
AW
1359Finally, let @r{@var{s}=@var{f}×@var{UP}^″}, and
1360@r{@var{u}=@var{s}×@var{f}}.
8925f36f
AW
1361
1362
1363
3c9b6116
AW
1364M is then constructed as follows: @r{@var{M}=((@var{s}⁡[0,] @var{s}⁡[1,]
1365@var{s}⁡[2,] 0), (@var{u}⁡[0,] @var{u}⁡[1,] @var{u}⁡[2,] 0),
1366(-@var{f}⁡[0,] -@var{f}⁡[1,] -@var{f}⁡[2,] 0), (0 0 0 1),)}
8925f36f
AW
1367
1368and @code{gluLookAt} is equivalent to
1369
1370@example
1371
1372glMultMatrixf(M);
1373glTranslated(-eyex, -eyey, -eyez);
1374@end example
1375
bb894c9d 1376@end deftypefun
8925f36f 1377
00239761 1378@deftypefun GLUnurbs* gluNewNurbsRenderer
3c9b6116
AW
1379Create a NURBS object.
1380
8925f36f 1381@code{gluNewNurbsRenderer} creates and returns a pointer to a new NURBS
f37e7e3d
DH
1382object. This object must be referred to when calling NURBS rendering and
1383control functions. A return value of 0 means that there is not enough
1384memory to allocate the object.
8925f36f 1385
bb894c9d 1386@end deftypefun
8925f36f 1387
00239761 1388@deftypefun GLUquadric* gluNewQuadric
3c9b6116
AW
1389Create a quadrics object.
1390
8925f36f 1391@code{gluNewQuadric} creates and returns a pointer to a new quadrics
f37e7e3d
DH
1392object. This object must be referred to when calling quadrics rendering
1393and control functions. A return value of 0 means that there is not
8925f36f
AW
1394enough memory to allocate the object.
1395
bb894c9d 1396@end deftypefun
8925f36f 1397
00239761 1398@deftypefun GLUtesselator* gluNewTess
3c9b6116
AW
1399Create a tessellation object.
1400
8925f36f 1401@code{gluNewTess} creates and returns a pointer to a new tessellation
f37e7e3d
DH
1402object. This object must be referred to when calling tessellation
1403functions. A return value of 0 means that there is not enough memory to
8925f36f
AW
1404allocate the object.
1405
bb894c9d 1406@end deftypefun
8925f36f 1407
bb894c9d 1408@deftypefun void gluNextContour tess type
3c9b6116
AW
1409Mark the beginning of another contour.
1410
8925f36f
AW
1411@table @asis
1412@item @var{tess}
1413Specifies the tessellation object (created with @code{gluNewTess}).
1414
1415@item @var{type}
f37e7e3d 1416Specifies the type of the contour being defined. Valid values are
8925f36f
AW
1417@code{GLU_EXTERIOR}, @code{GLU_INTERIOR}, @code{GLU_UNKNOWN},
1418@code{GLU_CCW}, and @code{GLU_CW}.
1419
1420@end table
1421
8925f36f 1422@code{gluNextContour} is used in describing polygons with multiple
f37e7e3d
DH
1423contours. After the first contour has been described through a series of
1424@code{gluTessVertex} calls, a @code{gluNextContour} call indicates that
1425the previous contour is complete and that the next contour is about to
1426begin. Another series of @code{gluTessVertex} calls is then used to
1427describe the new contour. This process can be repeated until all
8925f36f
AW
1428contours have been described.
1429
f37e7e3d
DH
1430@var{type} defines what type of contour follows. The legal contour types
1431are as follows:
8925f36f
AW
1432
1433@table @asis
1434@item @code{GLU_EXTERIOR}
1435An exterior contour defines an exterior boundary of the polygon.
1436
1437@item @code{GLU_INTERIOR}
1438An interior contour defines an interior boundary of the polygon (such as
1439a hole).
1440
1441@item @code{GLU_UNKNOWN}
1442An unknown contour is analyzed by the library to determine if it is
1443interior or exterior.
1444
1445@item @code{GLU_CCW},
1446@item @code{GLU_CW}
1447The first @code{GLU_CCW} or @code{GLU_CW} contour defined is considered
f37e7e3d
DH
1448to be exterior. All other contours are considered to be exterior if they
1449are oriented in the same direction (clockwise or counterclockwise) as
1450the first contour, and interior if they are not.
8925f36f
AW
1451
1452@end table
1453
1454If one contour is of type @code{GLU_CCW} or @code{GLU_CW}, then all
1455contours must be of the same type (if they are not, then all
1456@code{GLU_CCW} and @code{GLU_CW} contours will be changed to
1457@code{GLU_UNKNOWN}).
1458
1459Note that there is no real difference between the @code{GLU_CCW} and
1460@code{GLU_CW} contour types.
1461
1462Before the first contour is described, @code{gluNextContour} can be
f37e7e3d
DH
1463called to define the type of the first contour. If @code{gluNextContour}
1464is not called before the first contour, then the first contour is marked
1465@code{GLU_EXTERIOR}.
8925f36f
AW
1466
1467This command is obsolete and is provided for backward compatibility
f37e7e3d 1468only. Calls to @code{gluNextContour} are mapped to
8925f36f
AW
1469@code{gluTessEndContour} followed by @code{gluTessBeginContour}.
1470
bb894c9d 1471@end deftypefun
8925f36f 1472
bb894c9d 1473@deftypefun void gluNurbsCallbackDataEXT nurb userData
3c9b6116
AW
1474Set a user data pointer.
1475
8925f36f
AW
1476@table @asis
1477@item @var{nurb}
1478Specifies the NURBS object (created with @code{gluNewNurbsRenderer}).
1479
1480@item @var{userData}
1481Specifies a pointer to the user's data.
1482
1483@end table
1484
8925f36f 1485@code{gluNurbsCallbackDataEXT} is used to pass a pointer to the
f37e7e3d 1486application's data to NURBS tessellator. A copy of this pointer will be
8925f36f
AW
1487passed by the tessellator in the NURBS callback functions (set by
1488@code{gluNurbsCallback}).
1489
bb894c9d 1490@end deftypefun
8925f36f 1491
bb894c9d 1492@deftypefun void gluNurbsCallbackData nurb userData
3c9b6116
AW
1493Set a user data pointer.
1494
8925f36f
AW
1495@table @asis
1496@item @var{nurb}
1497Specifies the NURBS object (created with @code{gluNewNurbsRenderer}).
1498
1499@item @var{userData}
1500Specifies a pointer to the user's data.
1501
1502@end table
1503
8925f36f 1504@code{gluNurbsCallbackData} is used to pass a pointer to the
f37e7e3d 1505application's data to NURBS tessellator. A copy of this pointer will be
8925f36f
AW
1506passed by the tessellator in the NURBS callback functions (set by
1507@code{gluNurbsCallback}).
1508
bb894c9d 1509@end deftypefun
8925f36f 1510
bb894c9d 1511@deftypefun void gluNurbsCallback nurb which CallBackFunc
3c9b6116
AW
1512Define a callback for a NURBS object.
1513
8925f36f
AW
1514@table @asis
1515@item @var{nurb}
1516Specifies the NURBS object (created with @code{gluNewNurbsRenderer}).
1517
1518@item @var{which}
f37e7e3d 1519Specifies the callback being defined. Valid values are
8925f36f
AW
1520@code{GLU_NURBS_BEGIN}, @code{GLU_NURBS_VERTEX},
1521@code{GLU_NURBS_NORMAL}, @code{GLU_NURBS_COLOR},
1522@code{GLU_NURBS_TEXTURE_COORD}, @code{GLU_NURBS_END},
1523@code{GLU_NURBS_BEGIN_DATA}, @code{GLU_NURBS_VERTEX_DATA},
1524@code{GLU_NURBS_NORMAL_DATA}, @code{GLU_NURBS_COLOR_DATA},
1525@code{GLU_NURBS_TEXTURE_COORD_DATA}, @code{GLU_NURBS_END_DATA}, and
1526@code{GLU_NURBS_ERROR}.
1527
1528@item @var{CallBackFunc}
1529Specifies the function that the callback calls.
1530
1531@end table
1532
8925f36f 1533@code{gluNurbsCallback} is used to define a callback to be used by a
f37e7e3d
DH
1534NURBS object. If the specified callback is already defined, then it is
1535replaced. If @var{CallBackFunc} is NULL, then this callback will not get
1536invoked and the related data, if any, will be lost.
8925f36f
AW
1537
1538Except the error callback, these callbacks are used by NURBS tessellator
1539(when @code{GLU_NURBS_MODE} is set to be @code{GLU_NURBS_TESSELLATOR})
1540to return back the OpenGL polygon primitives resulting from the
f37e7e3d
DH
1541tessellation. Note that there are two versions of each callback: one
1542with a user data pointer and one without. If both versions for a
8925f36f 1543particular callback are specified then the callback with the user data
f37e7e3d 1544pointer will be used. Note that ``userData'' is a copy of the pointer
8925f36f
AW
1545that was specified at the last call to @code{gluNurbsCallbackData}.
1546
1547The error callback function is effective no matter which value that
f37e7e3d 1548@code{GLU_NURBS_MODE} is set to. All other callback functions are
8925f36f
AW
1549effective only when @code{GLU_NURBS_MODE} is set to
1550@code{GLU_NURBS_TESSELLATOR}.
1551
1552The legal callbacks are as follows:
1553
1554@table @asis
1555@item @code{GLU_NURBS_BEGIN}
1556
1557
f37e7e3d 1558The begin callback indicates the start of a primitive. The function
8925f36f
AW
1559takes a single argument of type GLenum, which can be one of
1560@code{GLU_LINES}, @code{GLU_LINE_STRIP}, @code{GLU_TRIANGLE_FAN},
1561@code{GLU_TRIANGLE_STRIP}, @code{GLU_TRIANGLES}, or
f37e7e3d 1562@code{GLU_QUAD_STRIP}. The default begin callback function is NULL. The
8925f36f
AW
1563function prototype for this callback looks like:
1564
1565@item @code{GLU_NURBS_BEGIN_DATA}
1566
1567
1568The same as the @code{GLU_NURBS_BEGIN} callback except that it takes an
f37e7e3d
DH
1569additional pointer argument. This pointer is a copy of the pointer that
1570was specified at the last call to @code{gluNurbsCallbackData}. The
1571default callback function is NULL. The function prototype for this
8925f36f
AW
1572callback function looks like:
1573
1574@item @code{GLU_NURBS_VERTEX}
1575
1576
f37e7e3d
DH
1577The vertex callback indicates a vertex of the primitive. The coordinates
1578of the vertex are stored in the parameter ``vertex''. All the generated
1579vertices have dimension 3; that is, homogeneous coordinates have been
1580transformed into affine coordinates. The default vertex callback
1581function is NULL. The function prototype for this callback function
1582looks like:
8925f36f
AW
1583
1584@item @code{GLU_NURBS_VERTEX_DATA}
1585
1586
1587This is the same as the @code{GLU_NURBS_VERTEX} callback, except that it
f37e7e3d 1588takes an additional pointer argument. This pointer is a copy of the
8925f36f 1589pointer that was specified at the last call to
f37e7e3d 1590@code{gluNurbsCallbackData}. The default callback function is NULL. The
8925f36f
AW
1591function prototype for this callback function looks like:
1592
1593@item @code{GLU_NURBS_NORMAL}
1594
1595
f37e7e3d 1596The normal callback is invoked as the vertex normal is generated. The
8925f36f
AW
1597components of the normal are stored in the parameter ``normal.'' In the
1598case of a NURBS curve, the callback function is effective only when the
f37e7e3d 1599user provides a normal map (@code{GLU_MAP1_NORMAL}). In the case of a
8925f36f 1600NURBS surface, if a normal map (@code{GLU_MAP2_NORMAL}) is provided,
f37e7e3d 1601then the generated normal is computed from the normal map. If a normal
8925f36f
AW
1602map is not provided, then a surface normal is computed in a manner
1603similar to that described for evaluators when @code{GLU_AUTO_NORMAL} is
f37e7e3d 1604enabled. The default normal callback function is NULL. The function
8925f36f
AW
1605prototype for this callback function looks like:
1606
1607@item @code{GLU_NURBS_NORMAL_DATA}
1608
1609
1610The same as the @code{GLU_NURBS_NORMAL} callback except that it takes an
f37e7e3d
DH
1611additional pointer argument. This pointer is a copy of the pointer that
1612was specified at the last call to @code{gluNurbsCallbackData}. The
1613default callback function is NULL. The function prototype for this
8925f36f
AW
1614callback function looks like:
1615
1616@item @code{GLU_NURBS_COLOR}
1617
1618
f37e7e3d 1619The color callback is invoked as the color of a vertex is generated. The
8925f36f
AW
1620components of the color are stored in the parameter ``color.'' This
1621callback is effective only when the user provides a color map
f37e7e3d
DH
1622(@code{GLU_MAP1_COLOR_4} or @code{GLU_MAP2_COLOR_4}). ``color'' contains
1623four components: R, G, B, A. The default color callback function is
1624NULL. The prototype for this callback function looks like:
8925f36f
AW
1625
1626@item @code{GLU_NURBS_COLOR_DATA}
1627
1628
1629The same as the @code{GLU_NURBS_COLOR} callback except that it takes an
f37e7e3d
DH
1630additional pointer argument. This pointer is a copy of the pointer that
1631was specified at the last call to @code{gluNurbsCallbackData}. The
1632default callback function is NULL. The function prototype for this
8925f36f
AW
1633callback function looks like:
1634
1635@item @code{GLU_NURBS_TEXTURE_COORD}
1636
1637
1638The texture callback is invoked as the texture coordinates of a vertex
f37e7e3d 1639are generated. These coordinates are stored in the parameter
8925f36f
AW
1640``texCoord.'' The number of texture coordinates can be 1, 2, 3, or 4
1641depending on which type of texture map is specified
1642(@code{GLU_MAP1_TEXTURE_COORD_1}, @code{GLU_MAP1_TEXTURE_COORD_2},
1643@code{GLU_MAP1_TEXTURE_COORD_3}, @code{GLU_MAP1_TEXTURE_COORD_4},
1644@code{GLU_MAP2_TEXTURE_COORD_1}, @code{GLU_MAP2_TEXTURE_COORD_2},
f37e7e3d
DH
1645@code{GLU_MAP2_TEXTURE_COORD_3}, @code{GLU_MAP2_TEXTURE_COORD_4}). If no
1646texture map is specified, this callback function will not be called. The
1647default texture callback function is NULL. The function prototype for
1648this callback function looks like:
8925f36f
AW
1649
1650@item @code{GLU_NURBS_TEXTURE_COORD_DATA}
1651
1652
1653This is the same as the @code{GLU_NURBS_TEXTURE_COORD} callback, except
f37e7e3d 1654that it takes an additional pointer argument. This pointer is a copy of
8925f36f 1655the pointer that was specified at the last call to
f37e7e3d 1656@code{gluNurbsCallbackData}. The default callback function is NULL. The
8925f36f
AW
1657function prototype for this callback function looks like:
1658
1659@item @code{GLU_NURBS_END}
1660
1661
f37e7e3d
DH
1662The end callback is invoked at the end of a primitive. The default end
1663callback function is NULL. The function prototype for this callback
8925f36f
AW
1664function looks like:
1665
1666@item @code{GLU_NURBS_END_DATA}
1667
1668
1669This is the same as the @code{GLU_NURBS_END} callback, except that it
f37e7e3d 1670takes an additional pointer argument. This pointer is a copy of the
8925f36f 1671pointer that was specified at the last call to
f37e7e3d 1672@code{gluNurbsCallbackData}. The default callback function is NULL. The
8925f36f
AW
1673function prototype for this callback function looks like:
1674
1675@item @code{GLU_NURBS_ERROR}
1676
1677
f37e7e3d 1678The error function is called when an error is encountered. Its single
8925f36f 1679argument is of type GLenum, and it indicates the specific error that
f37e7e3d
DH
1680occurred. There are 37 errors unique to NURBS, named
1681@code{GLU_NURBS_ERROR1} through @code{GLU_NURBS_ERROR37}. Character
8925f36f
AW
1682strings describing these errors can be retrieved with
1683@code{gluErrorString}.
1684
1685@end table
1686
1687@example
1688
1689void begin( GLenum type );
1690@end example
1691
1692@example
1693
1694void beginData(GLenum type, void *userData);
1695@end example
1696
1697@example
1698
1699void vertex( GLfloat *vertex );
1700@end example
1701
1702@example
1703
1704void vertexData( GLfloat *vertex, void *userData );
1705@end example
1706
1707@example
1708
1709void normal( GLfloat *normal );
1710@end example
1711
1712@example
1713
1714void normalData( GLfloat *normal, void *userData );
1715@end example
1716
1717@example
1718
1719void color( GLfloat *color );
1720@end example
1721
1722@example
1723
1724void colorData( GLfloat *color, void *userData );
1725@end example
1726
1727@example
1728
1729void texCoord( GLfloat *texCoord );
1730@end example
1731
1732@example
1733
1734void texCoordData( GLfloat *texCoord, void *userData );
1735@end example
1736
1737@example
1738
1739void end( void );
1740@end example
1741
1742@example
1743
1744void endData( void *userData );
1745@end example
1746
bb894c9d 1747@end deftypefun
8925f36f 1748
bb894c9d 1749@deftypefun void gluNurbsCurve nurb knotCount knots stride control order type
3c9b6116
AW
1750Define the shape of a NURBS curve.
1751
8925f36f
AW
1752@table @asis
1753@item @var{nurb}
1754Specifies the NURBS object (created with @code{gluNewNurbsRenderer}).
1755
1756@item @var{knotCount}
f37e7e3d
DH
1757Specifies the number of knots in @var{knots}. @var{knotCount} equals the
1758number of control points plus the order.
8925f36f
AW
1759
1760@item @var{knots}
1761Specifies an array of @var{knotCount} nondecreasing knot values.
1762
1763@item @var{stride}
1764Specifies the offset (as a number of single-precision floating-point
1765values) between successive curve control points.
1766
1767@item @var{control}
f37e7e3d 1768Specifies a pointer to an array of control points. The coordinates must
8925f36f
AW
1769agree with @var{type}, specified below.
1770
1771@item @var{order}
f37e7e3d 1772Specifies the order of the NURBS curve. @var{order} equals degree + 1,
8925f36f
AW
1773hence a cubic curve has an order of 4.
1774
1775@item @var{type}
f37e7e3d 1776Specifies the type of the curve. If this curve is defined within a
8925f36f
AW
1777@code{gluBeginCurve}/@code{gluEndCurve} pair, then the type can be any
1778of the valid one-dimensional evaluator types (such as
f37e7e3d 1779@code{GLU_MAP1_VERTEX_3} or @code{GLU_MAP1_COLOR_4}). Between a
8925f36f
AW
1780@code{gluBeginTrim}/@code{gluEndTrim} pair, the only valid types are
1781@code{GLU_MAP1_TRIM_2} and @code{GLU_MAP1_TRIM_3}.
1782
1783@end table
1784
8925f36f
AW
1785Use @code{gluNurbsCurve} to describe a NURBS curve.
1786
1787When @code{gluNurbsCurve} appears between a
1788@code{gluBeginCurve}/@code{gluEndCurve} pair, it is used to describe a
f37e7e3d 1789curve to be rendered. Positional, texture, and color coordinates are
8925f36f 1790associated by presenting each as a separate @code{gluNurbsCurve} between
f37e7e3d
DH
1791a @code{gluBeginCurve}/@code{gluEndCurve} pair. No more than one call to
1792@code{gluNurbsCurve} for each of color, position, and texture data can
1793be made within a single @code{gluBeginCurve}/@code{gluEndCurve} pair.
1794Exactly one call must be made to describe the position of the curve (a
1795@var{type} of @code{GLU_MAP1_VERTEX_3} or @code{GLU_MAP1_VERTEX_4}).
8925f36f
AW
1796
1797When @code{gluNurbsCurve} appears between a
1798@code{gluBeginTrim}/@code{gluEndTrim} pair, it is used to describe a
f37e7e3d 1799trimming curve on a NURBS surface. If @var{type} is
8925f36f 1800@code{GLU_MAP1_TRIM_2}, then it describes a curve in two-dimensional
f37e7e3d 1801(@var{u} and @var{v}) parameter space. If it is @code{GLU_MAP1_TRIM_3},
8925f36f 1802then it describes a curve in two-dimensional homogeneous (@var{u},
f37e7e3d 1803@var{v}, and @var{w}) parameter space. See the @code{gluBeginTrim}
8925f36f
AW
1804reference page for more discussion about trimming curves.
1805
bb894c9d 1806@end deftypefun
8925f36f 1807
bb894c9d 1808@deftypefun void gluNurbsProperty nurb property value
3c9b6116
AW
1809Set a NURBS property.
1810
8925f36f
AW
1811@table @asis
1812@item @var{nurb}
1813Specifies the NURBS object (created with @code{gluNewNurbsRenderer}).
1814
1815@item @var{property}
f37e7e3d 1816Specifies the property to be set. Valid values are
8925f36f
AW
1817@code{GLU_SAMPLING_TOLERANCE}, @code{GLU_DISPLAY_MODE},
1818@code{GLU_CULLING}, @code{GLU_AUTO_LOAD_MATRIX},
1819@code{GLU_PARAMETRIC_TOLERANCE}, @code{GLU_SAMPLING_METHOD},
1820@code{GLU_U_STEP}, @code{GLU_V_STEP}, or @code{GLU_NURBS_MODE}.
1821
1822@item @var{value}
f37e7e3d
DH
1823Specifies the value of the indicated property. It may be a numeric value
1824or one of @code{GLU_OUTLINE_POLYGON}, @code{GLU_FILL},
8925f36f
AW
1825@code{GLU_OUTLINE_PATCH}, @code{GLU_TRUE}, @code{GLU_FALSE},
1826@code{GLU_PATH_LENGTH}, @code{GLU_PARAMETRIC_ERROR},
1827@code{GLU_DOMAIN_DISTANCE}, @code{GLU_NURBS_RENDERER}, or
1828@code{GLU_NURBS_TESSELLATOR}.
1829
1830@end table
1831
8925f36f 1832@code{gluNurbsProperty} is used to control properties stored in a NURBS
f37e7e3d 1833object. These properties affect the way that a NURBS curve is rendered.
8925f36f
AW
1834The accepted values for @var{property} are as follows:
1835
1836@table @asis
1837@item @code{GLU_NURBS_MODE}
1838@var{value} should be set to be either @code{GLU_NURBS_RENDERER} or
f37e7e3d 1839@code{GLU_NURBS_TESSELLATOR}. When set to @code{GLU_NURBS_RENDERER},
8925f36f 1840NURBS objects are tessellated into OpenGL primitives and sent to the
f37e7e3d 1841pipeline for rendering. When set to @code{GLU_NURBS_TESSELLATOR}, NURBS
8925f36f
AW
1842objects are tessellated into OpenGL primitives but the vertices,
1843normals, colors, and/or textures are retrieved back through a callback
f37e7e3d
DH
1844interface (see @code{gluNurbsCallback}). This allows the user to cache
1845the tessellated results for further processing. The initial value is
8925f36f
AW
1846@code{GLU_NURBS_RENDERER}.
1847
1848@item @code{GLU_SAMPLING_METHOD}
f37e7e3d 1849Specifies how a NURBS surface should be tessellated. @var{value} may be
8925f36f
AW
1850one of @code{GLU_PATH_LENGTH}, @code{GLU_PARAMETRIC_ERROR},
1851@code{GLU_DOMAIN_DISTANCE}, @code{GLU_OBJECT_PATH_LENGTH}, or
f37e7e3d 1852@code{GLU_OBJECT_PARAMETRIC_ERROR}. When set to @code{GLU_PATH_LENGTH},
8925f36f
AW
1853the surface is rendered so that the maximum length, in pixels, of the
1854edges of the tessellation polygons is no greater than what is specified
1855by @code{GLU_SAMPLING_TOLERANCE}.
1856
1857@code{GLU_PARAMETRIC_ERROR} specifies that the surface is rendered in
1858such a way that the value specified by @code{GLU_PARAMETRIC_TOLERANCE}
1859describes the maximum distance, in pixels, between the tessellation
1860polygons and the surfaces they approximate.
1861
1862@code{GLU_DOMAIN_DISTANCE} allows users to specify, in parametric
1863coordinates, how many sample points per unit length are taken in
1864@var{u}, @var{v} direction.
1865
1866@code{GLU_OBJECT_PATH_LENGTH} is similar to @code{GLU_PATH_LENGTH}
1867except that it is view independent; that is, the surface is rendered so
1868that the maximum length, in object space, of edges of the tessellation
1869polygons is no greater than what is specified by
1870@code{GLU_SAMPLING_TOLERANCE}.
1871
1872@code{GLU_OBJECT_PARAMETRIC_ERROR} is similar to
1873@code{GLU_PARAMETRIC_ERROR} except that it is view independent; that is,
1874the surface is rendered in such a way that the value specified by
1875@code{GLU_PARAMETRIC_TOLERANCE} describes the maximum distance, in
1876object space, between the tessellation polygons and the surfaces they
1877approximate.
1878
1879The initial value of @code{GLU_SAMPLING_METHOD} is
1880@code{GLU_PATH_LENGTH}.
1881
1882@item @code{GLU_SAMPLING_TOLERANCE}
1883Specifies the maximum length, in pixels or in object space length unit,
1884to use when the sampling method is set to @code{GLU_PATH_LENGTH} or
f37e7e3d 1885@code{GLU_OBJECT_PATH_LENGTH}. The NURBS code is conservative when
8925f36f 1886rendering a curve or surface, so the actual length can be somewhat
f37e7e3d 1887shorter. The initial value is 50.0 pixels.
8925f36f
AW
1888
1889@item @code{GLU_PARAMETRIC_TOLERANCE}
1890Specifies the maximum distance, in pixels or in object space length
1891unit, to use when the sampling method is @code{GLU_PARAMETRIC_ERROR} or
f37e7e3d 1892@code{GLU_OBJECT_PARAMETRIC_ERROR}. The initial value is 0.5.
8925f36f
AW
1893
1894@item @code{GLU_U_STEP}
1895Specifies the number of sample points per unit length taken along the
f37e7e3d
DH
1896@var{u} axis in parametric coordinates. It is needed when
1897@code{GLU_SAMPLING_METHOD} is set to @code{GLU_DOMAIN_DISTANCE}. The
8925f36f
AW
1898initial value is 100.
1899
1900@item @code{GLU_V_STEP}
1901Specifies the number of sample points per unit length taken along the
f37e7e3d
DH
1902@var{v} axis in parametric coordinate. It is needed when
1903@code{GLU_SAMPLING_METHOD} is set to @code{GLU_DOMAIN_DISTANCE}. The
8925f36f
AW
1904initial value is 100.
1905
1906@item @code{GLU_DISPLAY_MODE}
1907@var{value} can be set to @code{GLU_OUTLINE_POLYGON}, @code{GLU_FILL},
f37e7e3d 1908or @code{GLU_OUTLINE_PATCH}. When @code{GLU_NURBS_MODE} is set to be
8925f36f 1909@code{GLU_NURBS_RENDERER}, @var{value} defines how a NURBS surface
f37e7e3d
DH
1910should be rendered. When @var{value} is set to @code{GLU_FILL}, the
1911surface is rendered as a set of polygons. When @var{value} is set to
8925f36f 1912@code{GLU_OUTLINE_POLYGON}, the NURBS library draws only the outlines of
f37e7e3d 1913the polygons created by tessellation. When @var{value} is set to
8925f36f
AW
1914@code{GLU_OUTLINE_PATCH} just the outlines of patches and trim curves
1915defined by the user are drawn.
1916
1917When @code{GLU_NURBS_MODE} is set to be @code{GLU_NURBS_TESSELLATOR},
f37e7e3d 1918@var{value} defines how a NURBS surface should be tessellated. When
8925f36f
AW
1919@code{GLU_DISPLAY_MODE} is set to @code{GLU_FILL} or
1920@code{GLU_OUTLINE_POLYGON}, the NURBS surface is tessellated into OpenGL
1921triangle primitives that can be retrieved back through callback
f37e7e3d 1922functions. If @code{GLU_DISPLAY_MODE} is set to
8925f36f
AW
1923@code{GLU_OUTLINE_PATCH}, only the outlines of the patches and trim
1924curves are generated as a sequence of line strips that can be retrieved
1925back through callback functions.
1926
1927The initial value is @code{GLU_FILL}.
1928
1929@item @code{GLU_CULLING}
1930@var{value} is a boolean value that, when set to @code{GLU_TRUE},
1931indicates that a NURBS curve should be discarded prior to tessellation
f37e7e3d 1932if its control points lie outside the current viewport. The initial
8925f36f
AW
1933value is @code{GLU_FALSE}.
1934
1935@item @code{GLU_AUTO_LOAD_MATRIX}
f37e7e3d 1936@var{value} is a boolean value. When set to @code{GLU_TRUE}, the NURBS
8925f36f
AW
1937code downloads the projection matrix, the modelview matrix, and the
1938viewport from the GL server to compute sampling and culling matrices for
f37e7e3d 1939each NURBS curve that is rendered. Sampling and culling matrices are
8925f36f
AW
1940required to determine the tessellation of a NURBS surface into line
1941segments or polygons and to cull a NURBS surface if it lies outside the
1942viewport.
1943
1944If this mode is set to @code{GLU_FALSE}, then the program needs to
1945provide a projection matrix, a modelview matrix, and a viewport for the
f37e7e3d
DH
1946NURBS renderer to use to construct sampling and culling matrices. This
1947can be done with the @code{gluLoadSamplingMatrices} function. This mode
1948is initially set to @code{GLU_TRUE}. Changing it from @code{GLU_TRUE} to
1949@code{GLU_FALSE} does not affect the sampling and culling matrices until
1950@code{gluLoadSamplingMatrices} is called.
8925f36f
AW
1951
1952@end table
1953
bb894c9d 1954@end deftypefun
8925f36f 1955
bb894c9d 1956@deftypefun void gluNurbsSurface nurb sKnotCount sKnots tKnotCount tKnots sStride tStride control sOrder tOrder type
3c9b6116
AW
1957Define the shape of a NURBS surface.
1958
8925f36f
AW
1959@table @asis
1960@item @var{nurb}
1961Specifies the NURBS object (created with @code{gluNewNurbsRenderer}).
1962
1963@item @var{sKnotCount}
1964Specifies the number of knots in the parametric @var{u} direction.
1965
1966@item @var{sKnots}
1967Specifies an array of @var{sKnotCount} nondecreasing knot values in the
1968parametric @var{u} direction.
1969
1970@item @var{tKnotCount}
1971Specifies the number of knots in the parametric @var{v} direction.
1972
1973@item @var{tKnots}
1974Specifies an array of @var{tKnotCount} nondecreasing knot values in the
1975parametric @var{v} direction.
1976
1977@item @var{sStride}
1978Specifies the offset (as a number of single-precision floating-point
1979values) between successive control points in the parametric @var{u}
1980direction in @var{control}.
1981
1982@item @var{tStride}
1983Specifies the offset (in single-precision floating-point values) between
1984successive control points in the parametric @var{v} direction in
1985@var{control}.
1986
1987@item @var{control}
f37e7e3d 1988Specifies an array containing control points for the NURBS surface. The
8925f36f
AW
1989offsets between successive control points in the parametric @var{u} and
1990@var{v} directions are given by @var{sStride} and @var{tStride}.
1991
1992@item @var{sOrder}
1993Specifies the order of the NURBS surface in the parametric @var{u}
f37e7e3d 1994direction. The order is one more than the degree, hence a surface that
8925f36f
AW
1995is cubic in @var{u} has a @var{u} order of 4.
1996
1997@item @var{tOrder}
1998Specifies the order of the NURBS surface in the parametric @var{v}
f37e7e3d 1999direction. The order is one more than the degree, hence a surface that
8925f36f
AW
2000is cubic in @var{v} has a @var{v} order of 4.
2001
2002@item @var{type}
f37e7e3d 2003Specifies type of the surface. @var{type} can be any of the valid
8925f36f
AW
2004two-dimensional evaluator types (such as @code{GLU_MAP2_VERTEX_3} or
2005@code{GLU_MAP2_COLOR_4}).
2006
2007@end table
2008
8925f36f
AW
2009Use @code{gluNurbsSurface} within a NURBS (Non-Uniform Rational
2010B-Spline) surface definition to describe the shape of a NURBS surface
f37e7e3d
DH
2011(before any trimming). To mark the beginning of a NURBS surface
2012definition, use the @code{gluBeginSurface} command. To mark the end of a
2013NURBS surface definition, use the @code{gluEndSurface} command. Call
8925f36f
AW
2014@code{gluNurbsSurface} within a NURBS surface definition only.
2015
2016Positional, texture, and color coordinates are associated with a surface
2017by presenting each as a separate @code{gluNurbsSurface} between a
f37e7e3d 2018@code{gluBeginSurface}/@code{gluEndSurface} pair. No more than one call
8925f36f
AW
2019to @code{gluNurbsSurface} for each of color, position, and texture data
2020can be made within a single @code{gluBeginSurface}/@code{gluEndSurface}
f37e7e3d 2021pair. Exactly one call must be made to describe the position of the
8925f36f
AW
2022surface (a @var{type} of @code{GLU_MAP2_VERTEX_3} or
2023@code{GLU_MAP2_VERTEX_4}).
2024
2025A NURBS surface can be trimmed by using the commands
2026@code{gluNurbsCurve} and @code{gluPwlCurve} between calls to
2027@code{gluBeginTrim} and @code{gluEndTrim}.
2028
2029Note that a @code{gluNurbsSurface} with @var{sKnotCount} knots in the
2030@var{u} direction and @var{tKnotCount} knots in the @var{v} direction
2031with orders @var{sOrder} and @var{tOrder} must have (@var{sKnotCount} -
3c9b6116
AW
2032@var{sOrder}) @r{@var{times}} (@var{tKnotCount} - @var{tOrder}) control
2033points.
8925f36f 2034
bb894c9d 2035@end deftypefun
8925f36f 2036
bb894c9d 2037@deftypefun void gluOrtho2D left right bottom top
3c9b6116
AW
2038Define a 2D orthographic projection matrix.
2039
8925f36f
AW
2040@table @asis
2041@item @var{left}
2042@itemx @var{right}
2043Specify the coordinates for the left and right vertical clipping planes.
2044
2045@item @var{bottom}
2046@itemx @var{top}
2047Specify the coordinates for the bottom and top horizontal clipping
2048planes.
2049
2050@end table
2051
8925f36f 2052@code{gluOrtho2D} sets up a two-dimensional orthographic viewing region.
3c9b6116
AW
2053This is equivalent to calling @code{glOrtho} with @r{@var{near}=-1} and
2054@r{@var{far}=1}.
8925f36f 2055
bb894c9d 2056@end deftypefun
8925f36f 2057
bb894c9d 2058@deftypefun void gluPartialDisk quad inner outer slices loops start sweep
3c9b6116
AW
2059Draw an arc of a disk.
2060
8925f36f
AW
2061@table @asis
2062@item @var{quad}
2063Specifies a quadrics object (created with @code{gluNewQuadric}).
2064
2065@item @var{inner}
2066Specifies the inner radius of the partial disk (can be 0).
2067
2068@item @var{outer}
2069Specifies the outer radius of the partial disk.
2070
2071@item @var{slices}
2072Specifies the number of subdivisions around the @var{z} axis.
2073
2074@item @var{loops}
2075Specifies the number of concentric rings about the origin into which the
2076partial disk is subdivided.
2077
2078@item @var{start}
2079Specifies the starting angle, in degrees, of the disk portion.
2080
2081@item @var{sweep}
2082Specifies the sweep angle, in degrees, of the disk portion.
2083
2084@end table
2085
3c9b6116
AW
2086@code{gluPartialDisk} renders a partial disk on the @r{@var{z}=0} plane.
2087A partial disk is similar to a full disk, except that only the subset of
2088the disk from @var{start} through @var{start} + @var{sweep} is included
2089(where 0 degrees is along the +\f2y\f axis, 90 degrees along the
2090+@var{x} axis, 180 degrees along the \-@var{y} axis, and 270 degrees
8925f36f
AW
2091along the \-@var{x} axis).
2092
2093The partial disk has a radius of @var{outer} and contains a concentric
f37e7e3d
DH
2094circular hole with a radius of @var{inner}. If @var{inner} is 0, then no
2095hole is generated. The partial disk is subdivided around the @var{z}
8925f36f
AW
2096axis into slices (like pizza slices) and also about the @var{z} axis
2097into rings (as specified by @var{slices} and @var{loops}, respectively).
2098
2099With respect to orientation, the +@var{z} side of the partial disk is
f37e7e3d 2100considered to be outside (see @code{gluQuadricOrientation}). This means
8925f36f 2101that if the orientation is set to @code{GLU_OUTSIDE}, then any normals
f37e7e3d
DH
2102generated point along the +@var{z} axis. Otherwise, they point along the
2103\-@var{z} axis.
8925f36f
AW
2104
2105If texturing is turned on (with @code{gluQuadricTexture}), texture
2106coordinates are generated linearly such that where
3c9b6116
AW
2107@r{@var{r}=@var{outer}}, the value at (@var{r}, 0, 0) is (1.0, 0.5), at
2108(0, @var{r}, 0) it is (0.5, 1.0), at (\-@var{r}, 0, 0) it is (0.0, 0.5),
2109and at (0, \-@var{r}, 0) it is (0.5, 0.0).
8925f36f 2110
bb894c9d 2111@end deftypefun
8925f36f 2112
bb894c9d 2113@deftypefun void gluPerspective fovy aspect zNear zFar
3c9b6116
AW
2114Set up a perspective projection matrix.
2115
8925f36f
AW
2116@table @asis
2117@item @var{fovy}
2118Specifies the field of view angle, in degrees, in the @var{y} direction.
2119
2120@item @var{aspect}
2121Specifies the aspect ratio that determines the field of view in the
f37e7e3d 2122@var{x} direction. The aspect ratio is the ratio of @var{x} (width) to
8925f36f
AW
2123@var{y} (height).
2124
2125@item @var{zNear}
2126Specifies the distance from the viewer to the near clipping plane
2127(always positive).
2128
2129@item @var{zFar}
2130Specifies the distance from the viewer to the far clipping plane (always
2131positive).
2132
2133@end table
2134
8925f36f 2135@code{gluPerspective} specifies a viewing frustum into the world
f37e7e3d
DH
2136coordinate system. In general, the aspect ratio in @code{gluPerspective}
2137should match the aspect ratio of the associated viewport. For example,
2138@r{@var{aspect}=2.0} means the viewer's angle of view is twice as wide
2139in @var{x} as it is in @var{y}. If the viewport is twice as wide as it
2140is tall, it displays the image without distortion.
8925f36f
AW
2141
2142The matrix generated by @code{gluPerspective} is multipled by the
2143current matrix, just as if @code{glMultMatrix} were called with the
f37e7e3d
DH
2144generated matrix. To load the perspective matrix onto the current matrix
2145stack instead, precede the call to @code{gluPerspective} with a call to
2146@code{glLoadIdentity}.
8925f36f
AW
2147
2148Given @var{f} defined as follows:
2149
3c9b6116 2150@r{@var{f}=@var{cotangent}⁡(@var{fovy}/2,)} The generated matrix is
8925f36f 2151
3c9b6116 2152@r{((@var{f}/@var{aspect} 0 0 0), (0 @var{f} 0 0), (0 0
8925f36f
AW
2153@var{zFar}+@var{zNear},/@var{zNear}-@var{zFar},
21542×@var{zFar}×@var{zNear},/@var{zNear}-@var{zFar},), (0 0 -1 0),)}
2155
bb894c9d 2156@end deftypefun
8925f36f 2157
bb894c9d 2158@deftypefun void gluPickMatrix x y delX delY viewport
3c9b6116
AW
2159Define a picking region.
2160
8925f36f
AW
2161@table @asis
2162@item @var{x}
2163@itemx @var{y}
2164Specify the center of a picking region in window coordinates.
2165
2166@item @var{delX}
2167@itemx @var{delY}
2168Specify the width and height, respectively, of the picking region in
2169window coordinates.
2170
2171@item @var{viewport}
2172Specifies the current viewport (as from a @code{glGetIntegerv} call).
2173
2174@end table
2175
8925f36f 2176@code{gluPickMatrix} creates a projection matrix that can be used to
f37e7e3d
DH
2177restrict drawing to a small region of the viewport. This is typically
2178useful to determine what objects are being drawn near the cursor. Use
8925f36f 2179@code{gluPickMatrix} to restrict drawing to a small region around the
f37e7e3d
DH
2180cursor. Then, enter selection mode (with @code{glRenderMode}) and
2181rerender the scene. All primitives that would have been drawn near the
8925f36f
AW
2182cursor are identified and stored in the selection buffer.
2183
2184The matrix created by @code{gluPickMatrix} is multiplied by the current
2185matrix just as if @code{glMultMatrix} is called with the generated
f37e7e3d 2186matrix. To effectively use the generated pick matrix for picking, first
8925f36f 2187call @code{glLoadIdentity} to load an identity matrix onto the
f37e7e3d 2188perspective matrix stack. Then call @code{gluPickMatrix}, and, finally,
8925f36f
AW
2189call a command (such as @code{gluPerspective}) to multiply the
2190perspective matrix by the pick matrix.
2191
2192When using @code{gluPickMatrix} to pick NURBS, be careful to turn off
f37e7e3d 2193the NURBS property @code{GLU_AUTO_LOAD_MATRIX}. If
8925f36f
AW
2194@code{GLU_AUTO_LOAD_MATRIX} is not turned off, then any NURBS surface
2195rendered is subdivided differently with the pick matrix than the way it
2196was subdivided without the pick matrix.
2197
bb894c9d 2198@end deftypefun
8925f36f 2199
bb894c9d 2200@deftypefun GLint gluProject objX objY objZ model proj view winX winY winZ
3c9b6116
AW
2201Map object coordinates to window coordinates.
2202
8925f36f
AW
2203@table @asis
2204@item @var{objX}
2205@itemx @var{objY}
2206@itemx @var{objZ}
2207Specify the object coordinates.
2208
2209@item @var{model}
2210Specifies the current modelview matrix (as from a @code{glGetDoublev}
2211call).
2212
2213@item @var{proj}
2214Specifies the current projection matrix (as from a @code{glGetDoublev}
2215call).
2216
2217@item @var{view}
2218Specifies the current viewport (as from a @code{glGetIntegerv} call).
2219
2220@item @var{winX}
2221@itemx @var{winY}
2222@itemx @var{winZ}
2223Return the computed window coordinates.
2224
2225@end table
2226
8925f36f 2227@code{gluProject} transforms the specified object coordinates into
f37e7e3d
DH
2228window coordinates using @var{model}, @var{proj}, and @var{view}. The
2229result is stored in @var{winX}, @var{winY}, and @var{winZ}. A return
8925f36f
AW
2230value of @code{GLU_TRUE} indicates success, a return value of
2231@code{GLU_FALSE} indicates failure.
2232
2233To compute the coordinates, let
3c9b6116 2234@r{@var{v}=(@var{objX},@var{objY}@var{objZ}1.0)} represented as a matrix
f37e7e3d 2235with 4 rows and 1 column. Then @code{gluProject} computes @r{@var{v}^″}
3c9b6116 2236as follows:
8925f36f 2237
3c9b6116 2238@r{@var{v}^″=@var{P}×@var{M}×@var{v}}
8925f36f 2239
3c9b6116
AW
2240where @r{@var{P}} is the current projection matrix @var{proj} and
2241@r{@var{M}} is the current modelview matrix @var{model} (both
2242represented as @r{4×4} matrices in column-major order).
8925f36f
AW
2243
2244The window coordinates are then computed as follows:
2245
3c9b6116
AW
2246@r{@var{winX}=@var{view}⁡(0,)+@var{view}⁡(2,)×(@var{v}^″⁡(0,)+1,)/2}@r{@var{winY}=@var{view}⁡(1,)+@var{view}⁡(3,)×(@var{v}^″⁡(1,)+1,)/2}
2247@r{@var{winZ}=(@var{v}^″⁡(2,)+1,)/2}
8925f36f
AW
2248
2249
2250
bb894c9d 2251@end deftypefun
8925f36f 2252
bb894c9d 2253@deftypefun void gluPwlCurve nurb count data stride type
3c9b6116
AW
2254Describe a piecewise linear NURBS trimming curve.
2255
8925f36f
AW
2256@table @asis
2257@item @var{nurb}
2258Specifies the NURBS object (created with @code{gluNewNurbsRenderer}).
2259
2260@item @var{count}
2261Specifies the number of points on the curve.
2262
2263@item @var{data}
2264Specifies an array containing the curve points.
2265
2266@item @var{stride}
2267Specifies the offset (a number of single-precision floating-point
2268values) between points on the curve.
2269
2270@item @var{type}
f37e7e3d 2271Specifies the type of curve. Must be either @code{GLU_MAP1_TRIM_2} or
8925f36f
AW
2272@code{GLU_MAP1_TRIM_3}.
2273
2274@end table
2275
8925f36f 2276@code{gluPwlCurve} describes a piecewise linear trimming curve for a
f37e7e3d 2277NURBS surface. A piecewise linear curve consists of a list of
8925f36f 2278coordinates of points in the parameter space for the NURBS surface to be
f37e7e3d 2279trimmed. These points are connected with line segments to form a curve.
8925f36f
AW
2280If the curve is an approximation to a curve that is not piecewise
2281linear, the points should be close enough in parameter space that the
2282resulting path appears curved at the resolution used in the application.
2283
2284If @var{type} is @code{GLU_MAP1_TRIM_2}, then it describes a curve in
f37e7e3d 2285two-dimensional (@var{u} and @var{v}) parameter space. If it is
8925f36f 2286@code{GLU_MAP1_TRIM_3}, then it describes a curve in two-dimensional
f37e7e3d 2287homogeneous (@var{u}, @var{v}, and @var{w}) parameter space. See the
8925f36f
AW
2288@code{gluBeginTrim} reference page for more information about trimming
2289curves.
2290
bb894c9d 2291@end deftypefun
8925f36f 2292
bb894c9d 2293@deftypefun void gluQuadricCallback quad which CallBackFunc
3c9b6116
AW
2294Define a callback for a quadrics object.
2295
8925f36f
AW
2296@table @asis
2297@item @var{quad}
2298Specifies the quadrics object (created with @code{gluNewQuadric}).
2299
2300@item @var{which}
f37e7e3d 2301Specifies the callback being defined. The only valid value is
8925f36f
AW
2302@code{GLU_ERROR}.
2303
2304@item @var{CallBackFunc}
2305Specifies the function to be called.
2306
2307@end table
2308
8925f36f 2309@code{gluQuadricCallback} is used to define a new callback to be used by
f37e7e3d
DH
2310a quadrics object. If the specified callback is already defined, then it
2311is replaced. If @var{CallBackFunc} is NULL, then any existing callback
2312is erased.
8925f36f
AW
2313
2314The one legal callback is @code{GLU_ERROR}:
2315
2316@table @asis
2317@item @code{GLU_ERROR}
f37e7e3d
DH
2318The function is called when an error is encountered. Its single argument
2319is of type GLenum, and it indicates the specific error that occurred.
2320Character strings describing these errors can be retrieved with the
2321@code{gluErrorString} call.
8925f36f
AW
2322
2323@end table
2324
bb894c9d 2325@end deftypefun
8925f36f 2326
bb894c9d 2327@deftypefun void gluQuadricDrawStyle quad draw
3c9b6116
AW
2328Specify the draw style desired for quadrics.
2329
8925f36f
AW
2330@table @asis
2331@item @var{quad}
2332Specifies the quadrics object (created with @code{gluNewQuadric}).
2333
2334@item @var{draw}
f37e7e3d 2335Specifies the desired draw style. Valid values are @code{GLU_FILL},
8925f36f
AW
2336@code{GLU_LINE}, @code{GLU_SILHOUETTE}, and @code{GLU_POINT}.
2337
2338@end table
2339
8925f36f 2340@code{gluQuadricDrawStyle} specifies the draw style for quadrics
f37e7e3d 2341rendered with @var{quad}. The legal values are as follows:
8925f36f
AW
2342
2343@table @asis
2344@item @code{GLU_FILL}
f37e7e3d
DH
2345Quadrics are rendered with polygon primitives. The polygons are drawn in
2346a counterclockwise fashion with respect to their normals (as defined
8925f36f
AW
2347with @code{gluQuadricOrientation}).
2348
2349@item @code{GLU_LINE}
2350Quadrics are rendered as a set of lines.
2351
2352@item @code{GLU_SILHOUETTE}
2353Quadrics are rendered as a set of lines, except that edges separating
2354coplanar faces will not be drawn.
2355
2356@item @code{GLU_POINT}
2357Quadrics are rendered as a set of points.
2358
2359@end table
2360
bb894c9d 2361@end deftypefun
8925f36f 2362
bb894c9d 2363@deftypefun void gluQuadricNormals quad normal
3c9b6116
AW
2364Specify what kind of normals are desired for quadrics.
2365
8925f36f
AW
2366@table @asis
2367@item @var{quad}
2368Specifies the quadrics object (created with @code{gluNewQuadric}).
2369
2370@item @var{normal}
f37e7e3d
DH
2371Specifies the desired type of normals. Valid values are @code{GLU_NONE},
2372@code{GLU_FLAT}, and @code{GLU_SMOOTH}.
8925f36f
AW
2373
2374@end table
2375
8925f36f 2376@code{gluQuadricNormals} specifies what kind of normals are desired for
f37e7e3d 2377quadrics rendered with @var{quad}. The legal values are as follows:
8925f36f
AW
2378
2379@table @asis
2380@item @code{GLU_NONE}
2381No normals are generated.
2382
2383@item @code{GLU_FLAT}
2384One normal is generated for every facet of a quadric.
2385
2386@item @code{GLU_SMOOTH}
f37e7e3d 2387One normal is generated for every vertex of a quadric. This is the
8925f36f
AW
2388initial value.
2389
2390@end table
2391
bb894c9d 2392@end deftypefun
8925f36f 2393
bb894c9d 2394@deftypefun void gluQuadricOrientation quad orientation
3c9b6116
AW
2395Specify inside/outside orientation for quadrics.
2396
8925f36f
AW
2397@table @asis
2398@item @var{quad}
2399Specifies the quadrics object (created with @code{gluNewQuadric}).
2400
2401@item @var{orientation}
f37e7e3d 2402Specifies the desired orientation. Valid values are @code{GLU_OUTSIDE}
8925f36f
AW
2403and @code{GLU_INSIDE}.
2404
2405@end table
2406
8925f36f 2407@code{gluQuadricOrientation} specifies what kind of orientation is
f37e7e3d 2408desired for quadrics rendered with @var{quad}. The @var{orientation}
8925f36f
AW
2409values are as follows:
2410
2411@table @asis
2412@item @code{GLU_OUTSIDE}
2413Quadrics are drawn with normals pointing outward (the initial value).
2414
2415@item @code{GLU_INSIDE}
2416Quadrics are drawn with normals pointing inward.
2417
2418@end table
2419
2420Note that the interpretation of @var{outward} and @var{inward} depends
2421on the quadric being drawn.
2422
bb894c9d 2423@end deftypefun
8925f36f 2424
bb894c9d 2425@deftypefun void gluQuadricTexture quad texture
3c9b6116
AW
2426Specify if texturing is desired for quadrics.
2427
8925f36f
AW
2428@table @asis
2429@item @var{quad}
2430Specifies the quadrics object (created with @code{gluNewQuadric}).
2431
2432@item @var{texture}
2433Specifies a flag indicating if texture coordinates should be generated.
2434
2435@end table
2436
8925f36f 2437@code{gluQuadricTexture} specifies if texture coordinates should be
f37e7e3d 2438generated for quadrics rendered with @var{quad}. If the value of
8925f36f 2439@var{texture} is @code{GLU_TRUE}, then texture coordinates are
f37e7e3d 2440generated, and if @var{texture} is @code{GLU_FALSE}, they are not. The
8925f36f
AW
2441initial value is @code{GLU_FALSE}.
2442
2443The manner in which texture coordinates are generated depends upon the
2444specific quadric rendered.
2445
bb894c9d 2446@end deftypefun
8925f36f 2447
bb894c9d 2448@deftypefun GLint gluScaleImage format wIn hIn typeIn dataIn wOut hOut typeOut dataOut
3c9b6116
AW
2449Scale an image to an arbitrary size.
2450
8925f36f
AW
2451@table @asis
2452@item @var{format}
f37e7e3d 2453Specifies the format of the pixel data. The following symbolic values
8925f36f
AW
2454are valid: @code{GLU_COLOR_INDEX}, @code{GLU_STENCIL_INDEX},
2455@code{GLU_DEPTH_COMPONENT}, @code{GLU_RED}, @code{GLU_GREEN},
2456@code{GLU_BLUE}, @code{GLU_ALPHA}, @code{GLU_RGB}, @code{GLU_RGBA},
2457@code{GLU_BGR}, @code{GLU_BGRA}, @code{GLU_LUMINANCE}, and
2458@code{GLU_LUMINANCE_ALPHA}.
2459
2460@item @var{wIn}
2461@itemx @var{hIn}
2462Specify in pixels the width and height, respectively, of the source
2463image.
2464
2465@item @var{typeIn}
f37e7e3d 2466Specifies the data type for @var{dataIn}. Must be one of
8925f36f
AW
2467@code{GLU_UNSIGNED_BYTE}, @code{GLU_BYTE}, @code{GLU_BITMAP},
2468@code{GLU_UNSIGNED_SHORT}, @code{GLU_SHORT}, @code{GLU_UNSIGNED_INT},
2469@code{GLU_INT}, @code{GLU_FLOAT}, @code{GLU_UNSIGNED_BYTE_3_3_2},
2470@code{GLU_UNSIGNED_BYTE_2_3_3_REV}, @code{GLU_UNSIGNED_SHORT_5_6_5},
2471@code{GLU_UNSIGNED_SHORT_5_6_5_REV}, @code{GLU_UNSIGNED_SHORT_4_4_4_4},
2472@code{GLU_UNSIGNED_SHORT_4_4_4_4_REV},
2473@code{GLU_UNSIGNED_SHORT_5_5_5_1},
2474@code{GLU_UNSIGNED_SHORT_1_5_5_5_REV}, @code{GLU_UNSIGNED_INT_8_8_8_8},
2475@code{GLU_UNSIGNED_INT_8_8_8_8_REV}, @code{GLU_UNSIGNED_INT_10_10_10_2},
2476or @code{GLU_UNSIGNED_INT_2_10_10_10_REV}.
2477
2478@item @var{dataIn}
2479Specifies a pointer to the source image.
2480
2481@item @var{wOut}
2482@itemx @var{hOut}
2483Specify the width and height, respectively, in pixels of the destination
2484image.
2485
2486@item @var{typeOut}
f37e7e3d 2487Specifies the data type for @var{dataOut}. Must be one of
8925f36f
AW
2488@code{GLU_UNSIGNED_BYTE}, @code{GLU_BYTE}, @code{GLU_BITMAP},
2489@code{GLU_UNSIGNED_SHORT}, @code{GLU_SHORT}, @code{GLU_UNSIGNED_INT},
2490@code{GLU_INT}, @code{GLU_FLOAT}, @code{GLU_UNSIGNED_BYTE_3_3_2},
2491@code{GLU_UNSIGNED_BYTE_2_3_3_REV}, @code{GLU_UNSIGNED_SHORT_5_6_5},
2492@code{GLU_UNSIGNED_SHORT_5_6_5_REV}, @code{GLU_UNSIGNED_SHORT_4_4_4_4},
2493@code{GLU_UNSIGNED_SHORT_4_4_4_4_REV},
2494@code{GLU_UNSIGNED_SHORT_5_5_5_1},
2495@code{GLU_UNSIGNED_SHORT_1_5_5_5_REV}, @code{GLU_UNSIGNED_INT_8_8_8_8},
2496@code{GLU_UNSIGNED_INT_8_8_8_8_REV}, @code{GLU_UNSIGNED_INT_10_10_10_2},
2497or @code{GLU_UNSIGNED_INT_2_10_10_10_REV}.
2498
2499@item @var{dataOut}
2500Specifies a pointer to the destination image.
2501
2502@end table
2503
8925f36f
AW
2504@code{gluScaleImage} scales a pixel image using the appropriate pixel
2505store modes to unpack data from the source image and pack data into the
2506destination image.
2507
2508When shrinking an image, @code{gluScaleImage} uses a box filter to
2509sample the source image and create pixels for the destination image.
2510When magnifying an image, the pixels from the source image are linearly
2511interpolated to create the destination image.
2512
2513A return value of zero indicates success, otherwise a GLU error code is
2514returned (see @code{gluErrorString}).
2515
2516See the @code{glReadPixels} reference page for a description of the
2517acceptable values for the @var{format}, @var{typeIn}, and @var{typeOut}
2518parameters.
2519
8925f36f
AW
2520@code{GLU_INVALID_VALUE} is returned if @var{wIn}, @var{hIn},
2521@var{wOut}, or @var{hOut} is negative.
2522
2523@code{GLU_INVALID_ENUM} is returned if @var{format}, @var{typeIn}, or
2524@var{typeOut} is not legal.
2525
2526@code{GLU_INVALID_OPERATION} is returned if @var{typeIn} or
2527@var{typeOut} is @code{GLU_UNSIGNED_BYTE_3_3_2} or
2528@code{GLU_UNSIGNED_BYTE_2_3_3_REV} and @var{format} is not
2529@code{GLU_RGB}.
2530
2531@code{GLU_INVALID_OPERATION} is returned if @var{typeIn} or
2532@var{typeOut} is @code{GLU_UNSIGNED_SHORT_5_6_5} or
2533@code{GLU_UNSIGNED_SHORT_5_6_5_REV} and @var{format} is not
2534@code{GLU_RGB}.
2535
2536@code{GLU_INVALID_OPERATION} is returned if @var{typeIn} or
2537@var{typeOut} is @code{GLU_UNSIGNED_SHORT_4_4_4_4} or
2538@code{GLU_UNSIGNED_SHORT_4_4_4_4_REV} and @var{format} is neither
2539@code{GLU_RGBA} nor @code{GLU_BGRA}.
2540
2541@code{GLU_INVALID_OPERATION} is returned if @var{typeIn} or
2542@var{typeOut} is @code{GLU_UNSIGNED_SHORT_5_5_5_1} or
2543@code{GLU_UNSIGNED_SHORT_1_5_5_5_REV} and @var{format} is neither
2544@code{GLU_RGBA} nor @code{GLU_BGRA}.
2545
2546@code{GLU_INVALID_OPERATION} is returned if @var{typeIn} or
2547@var{typeOut} is @code{GLU_UNSIGNED_INT_8_8_8_8} or
2548@code{GLU_UNSIGNED_INT_8_8_8_8_REV} and @var{format} is neither
2549@code{GLU_RGBA} nor @code{GLU_BGRA}.
2550
2551@code{GLU_INVALID_OPERATION} is returned if @var{typeIn} or
2552@var{typeOut} is @code{GLU_UNSIGNED_INT_10_10_10_2} or
2553@code{GLU_UNSIGNED_INT_2_10_10_10_REV} and @var{format} is neither
2554@code{GLU_RGBA} nor @code{GLU_BGRA}.
2555
bb894c9d 2556@end deftypefun
8925f36f 2557
bb894c9d 2558@deftypefun void gluSphere quad radius slices stacks
3c9b6116
AW
2559Draw a sphere.
2560
8925f36f
AW
2561@table @asis
2562@item @var{quad}
2563Specifies the quadrics object (created with @code{gluNewQuadric}).
2564
2565@item @var{radius}
2566Specifies the radius of the sphere.
2567
2568@item @var{slices}
2569Specifies the number of subdivisions around the @var{z} axis (similar to
2570lines of longitude).
2571
2572@item @var{stacks}
2573Specifies the number of subdivisions along the @var{z} axis (similar to
2574lines of latitude).
2575
2576@end table
2577
8925f36f 2578@code{gluSphere} draws a sphere of the given radius centered around the
f37e7e3d
DH
2579origin. The sphere is subdivided around the @var{z} axis into slices and
2580along the @var{z} axis into stacks (similar to lines of longitude and
2581latitude).
8925f36f
AW
2582
2583If the orientation is set to @code{GLU_OUTSIDE} (with
2584@code{gluQuadricOrientation}), then any normals generated point away
f37e7e3d 2585from the center of the sphere. Otherwise, they point toward the center
8925f36f
AW
2586of the sphere.
2587
2588If texturing is turned on (with @code{gluQuadricTexture}), then texture
2589coordinates are generated so that @var{t} ranges from 0.0 at
3c9b6116
AW
2590@r{@var{z}=-@var{radius}} to 1.0 at @r{@var{z}=@var{radius}} (@var{t}
2591increases linearly along longitudinal lines), and @var{s} ranges from
25920.0 at the +@var{y} axis, to 0.25 at the +@var{x} axis, to 0.5 at the
2593\-@var{y} axis, to 0.75 at the \-@var{x} axis, and back to 1.0 at the
2594+@var{y} axis.
8925f36f 2595
bb894c9d 2596@end deftypefun
8925f36f 2597
bb894c9d
AW
2598@deftypefun void gluTessBeginContour tess
2599@deftypefunx void gluTessEndContour tess
3c9b6116
AW
2600Delimit a contour description.
2601
8925f36f
AW
2602@table @asis
2603@item @var{tess}
2604Specifies the tessellation object (created with @code{gluNewTess}).
2605
2606@end table
2607
8925f36f 2608@code{gluTessBeginContour} and @code{gluTessEndContour} delimit the
f37e7e3d 2609definition of a polygon contour. Within each
8925f36f 2610@code{gluTessBeginContour}/@code{gluTessEndContour} pair, there can be
f37e7e3d 2611zero or more calls to @code{gluTessVertex}. The vertices specify a
8925f36f 2612closed contour (the last vertex of each contour is automatically linked
f37e7e3d
DH
2613to the first). See the @code{gluTessVertex} reference page for more
2614details. @code{gluTessBeginContour} can only be called between
8925f36f
AW
2615@code{gluTessBeginPolygon} and @code{gluTessEndPolygon}.
2616
bb894c9d 2617@end deftypefun
8925f36f 2618
bb894c9d 2619@deftypefun void gluTessBeginPolygon tess data
3c9b6116
AW
2620Delimit a polygon description.
2621
8925f36f
AW
2622@table @asis
2623@item @var{tess}
2624Specifies the tessellation object (created with @code{gluNewTess}).
2625
2626@item @var{data}
2627Specifies a pointer to user polygon data.
2628
2629@end table
2630
8925f36f 2631@code{gluTessBeginPolygon} and @code{gluTessEndPolygon} delimit the
f37e7e3d 2632definition of a convex, concave or self-intersecting polygon. Within
8925f36f
AW
2633each @code{gluTessBeginPolygon}/@code{gluTessEndPolygon} pair, there
2634must be one or more calls to
f37e7e3d
DH
2635@code{gluTessBeginContour}/@code{gluTessEndContour}. Within each
2636contour, there are zero or more calls to @code{gluTessVertex}. The
8925f36f 2637vertices specify a closed contour (the last vertex of each contour is
f37e7e3d 2638automatically linked to the first). See the @code{gluTessVertex},
8925f36f
AW
2639@code{gluTessBeginContour}, and @code{gluTessEndContour} reference pages
2640for more details.
2641
f37e7e3d 2642@var{data} is a pointer to a user-defined data structure. If the
8925f36f 2643appropriate callback(s) are specified (see @code{gluTessCallback}), then
f37e7e3d 2644this pointer is returned to the callback function(s). Thus, it is a
8925f36f
AW
2645convenient way to store per-polygon information.
2646
2647Once @code{gluTessEndPolygon} is called, the polygon is tessellated, and
f37e7e3d 2648the resulting triangles are described through callbacks. See
8925f36f
AW
2649@code{gluTessCallback} for descriptions of the callback functions.
2650
bb894c9d 2651@end deftypefun
8925f36f 2652
bb894c9d 2653@deftypefun void gluTessCallback tess which CallBackFunc
3c9b6116
AW
2654Define a callback for a tessellation object.
2655
8925f36f
AW
2656@table @asis
2657@item @var{tess}
2658Specifies the tessellation object (created with @code{gluNewTess}).
2659
2660@item @var{which}
f37e7e3d 2661Specifies the callback being defined. The following values are valid:
8925f36f
AW
2662@code{GLU_TESS_BEGIN}, @code{GLU_TESS_BEGIN_DATA},
2663@code{GLU_TESS_EDGE_FLAG}, @code{GLU_TESS_EDGE_FLAG_DATA},
2664@code{GLU_TESS_VERTEX}, @code{GLU_TESS_VERTEX_DATA},
2665@code{GLU_TESS_END}, @code{GLU_TESS_END_DATA}, @code{GLU_TESS_COMBINE},
2666@code{GLU_TESS_COMBINE_DATA}, @code{GLU_TESS_ERROR}, and
2667@code{GLU_TESS_ERROR_DATA}.
2668
2669@item @var{CallBackFunc}
2670Specifies the function to be called.
2671
2672@end table
2673
8925f36f 2674@code{gluTessCallback} is used to indicate a callback to be used by a
f37e7e3d
DH
2675tessellation object. If the specified callback is already defined, then
2676it is replaced. If @var{CallBackFunc} is NULL, then the existing
8925f36f
AW
2677callback becomes undefined.
2678
2679These callbacks are used by the tessellation object to describe how a
f37e7e3d 2680polygon specified by the user is broken into triangles. Note that there
8925f36f 2681are two versions of each callback: one with user-specified polygon data
f37e7e3d 2682and one without. If both versions of a particular callback are
8925f36f 2683specified, then the callback with user-specified polygon data will be
f37e7e3d 2684used. Note that the @var{polygon_data} parameter used by some of the
8925f36f 2685functions is a copy of the pointer that was specified when
f37e7e3d 2686@code{gluTessBeginPolygon} was called. The legal callbacks are as
8925f36f
AW
2687follows:
2688
2689@table @asis
2690@item @code{GLU_TESS_BEGIN}
2691The begin callback is invoked like @code{glBegin} to indicate the start
f37e7e3d
DH
2692of a (triangle) primitive. The function takes a single argument of type
2693GLenum. If the @code{GLU_TESS_BOUNDARY_ONLY} property is set to
8925f36f
AW
2694@code{GLU_FALSE}, then the argument is set to either
2695@code{GLU_TRIANGLE_FAN}, @code{GLU_TRIANGLE_STRIP}, or
f37e7e3d 2696@code{GLU_TRIANGLES}. If the @code{GLU_TESS_BOUNDARY_ONLY} property is
8925f36f 2697set to @code{GLU_TRUE}, then the argument will be set to
f37e7e3d 2698@code{GLU_LINE_LOOP}. The function prototype for this callback is:
8925f36f
AW
2699
2700@item @code{GLU_TESS_BEGIN_DATA}
2701The same as the @code{GLU_TESS_BEGIN} callback except that it takes an
f37e7e3d
DH
2702additional pointer argument. This pointer is identical to the opaque
2703pointer provided when @code{gluTessBeginPolygon} was called. The
8925f36f
AW
2704function prototype for this callback is:
2705
2706@item @code{GLU_TESS_EDGE_FLAG}
f37e7e3d 2707The edge flag callback is similar to @code{glEdgeFlag}. The function
8925f36f 2708takes a single boolean flag that indicates which edges lie on the
f37e7e3d 2709polygon boundary. If the flag is @code{GLU_TRUE}, then each vertex that
8925f36f 2710follows begins an edge that lies on the polygon boundary, that is, an
f37e7e3d
DH
2711edge that separates an interior region from an exterior one. If the flag
2712is @code{GLU_FALSE}, then each vertex that follows begins an edge that
2713lies in the polygon interior. The edge flag callback (if defined) is
2714invoked before the first vertex callback.
8925f36f
AW
2715
2716Since triangle fans and triangle strips do not support edge flags, the
2717begin callback is not called with @code{GLU_TRIANGLE_FAN} or
2718@code{GLU_TRIANGLE_STRIP} if a non-NULL edge flag callback is provided.
2719(If the callback is initialized to NULL, there is no impact on
f37e7e3d
DH
2720performance). Instead, the fans and strips are converted to independent
2721triangles. The function prototype for this callback is:
8925f36f
AW
2722
2723@item @code{GLU_TESS_EDGE_FLAG_DATA}
2724The same as the @code{GLU_TESS_EDGE_FLAG} callback except that it takes
f37e7e3d
DH
2725an additional pointer argument. This pointer is identical to the opaque
2726pointer provided when @code{gluTessBeginPolygon} was called. The
8925f36f
AW
2727function prototype for this callback is:
2728
2729@item @code{GLU_TESS_VERTEX}
f37e7e3d 2730The vertex callback is invoked between the begin and end callbacks. It
8925f36f 2731is similar to @code{glVertex}, and it defines the vertices of the
f37e7e3d
DH
2732triangles created by the tessellation process. The function takes a
2733pointer as its only argument. This pointer is identical to the opaque
8925f36f 2734pointer provided by the user when the vertex was described (see
f37e7e3d 2735@code{gluTessVertex}). The function prototype for this callback is:
8925f36f
AW
2736
2737@item @code{GLU_TESS_VERTEX_DATA}
2738The same as the @code{GLU_TESS_VERTEX} callback except that it takes an
f37e7e3d
DH
2739additional pointer argument. This pointer is identical to the opaque
2740pointer provided when @code{gluTessBeginPolygon} was called. The
8925f36f
AW
2741function prototype for this callback is:
2742
2743@item @code{GLU_TESS_END}
f37e7e3d
DH
2744The end callback serves the same purpose as @code{glEnd}. It indicates
2745the end of a primitive and it takes no arguments. The function prototype
2746for this callback is:
8925f36f
AW
2747
2748@item @code{GLU_TESS_END_DATA}
2749The same as the @code{GLU_TESS_END} callback except that it takes an
f37e7e3d
DH
2750additional pointer argument. This pointer is identical to the opaque
2751pointer provided when @code{gluTessBeginPolygon} was called. The
8925f36f
AW
2752function prototype for this callback is:
2753
2754@item @code{GLU_TESS_COMBINE}
2755The combine callback is called to create a new vertex when the
f37e7e3d 2756tessellation detects an intersection or wishes to merge features. The
8925f36f
AW
2757function takes four arguments: an array of three elements each of type
2758GLdouble, an array of four pointers, an array of four elements each of
f37e7e3d 2759type GLfloat, and a pointer to a pointer. The prototype is:
8925f36f
AW
2760
2761The vertex is defined as a linear combination of up to four existing
f37e7e3d 2762vertices, stored in @var{vertex_data}. The coefficients of the linear
8925f36f
AW
2763combination are given by @var{weight}; these weights always add up to 1.
2764All vertex pointers are valid even when some of the weights are 0.
2765@var{coords} gives the location of the new vertex.
2766
2767The user must allocate another vertex, interpolate parameters using
2768@var{vertex_data} and @var{weight}, and return the new vertex pointer in
f37e7e3d 2769@var{outData}. This handle is supplied during rendering callbacks. The
8925f36f
AW
2770user is responsible for freeing the memory some time after
2771@code{gluTessEndPolygon} is called.
2772
2773For example, if the polygon lies in an arbitrary plane in 3-space, and a
2774color is associated with each vertex, the @code{GLU_TESS_COMBINE}
2775callback might look like this:
2776
2777If the tessellation detects an intersection, then the
2778@code{GLU_TESS_COMBINE} or @code{GLU_TESS_COMBINE_DATA} callback (see
2779below) must be defined, and it must write a non-NULL pointer into
f37e7e3d
DH
2780@var{dataOut}. Otherwise the @code{GLU_TESS_NEED_COMBINE_CALLBACK} error
2781occurs, and no output is generated.
8925f36f
AW
2782
2783@item @code{GLU_TESS_COMBINE_DATA}
2784The same as the @code{GLU_TESS_COMBINE} callback except that it takes an
f37e7e3d
DH
2785additional pointer argument. This pointer is identical to the opaque
2786pointer provided when @code{gluTessBeginPolygon} was called. The
8925f36f
AW
2787function prototype for this callback is:
2788
2789@item @code{GLU_TESS_ERROR}
f37e7e3d 2790The error callback is called when an error is encountered. The one
8925f36f
AW
2791argument is of type GLenum; it indicates the specific error that
2792occurred and will be set to one of
2793@code{GLU_TESS_MISSING_BEGIN_POLYGON},
2794@code{GLU_TESS_MISSING_END_POLYGON},
2795@code{GLU_TESS_MISSING_BEGIN_CONTOUR},
2796@code{GLU_TESS_MISSING_END_CONTOUR}, @code{GLU_TESS_COORD_TOO_LARGE},
2797@code{GLU_TESS_NEED_COMBINE_CALLBACK}, or @code{GLU_OUT_OF_MEMORY}.
2798Character strings describing these errors can be retrieved with the
f37e7e3d 2799@code{gluErrorString} call. The function prototype for this callback is:
8925f36f
AW
2800
2801The GLU library will recover from the first four errors by inserting the
f37e7e3d 2802missing call(s). @code{GLU_TESS_COORD_TOO_LARGE} indicates that some
8925f36f
AW
2803vertex coordinate exceeded the predefined constant
2804@code{GLU_TESS_MAX_COORD} in absolute value, and that the value has been
f37e7e3d 2805clamped. (Coordinate values must be small enough so that two can be
8925f36f
AW
2806multiplied together without overflow.)
2807@code{GLU_TESS_NEED_COMBINE_CALLBACK} indicates that the tessellation
2808detected an intersection between two edges in the input data, and the
2809@code{GLU_TESS_COMBINE} or @code{GLU_TESS_COMBINE_DATA} callback was not
f37e7e3d 2810provided. No output is generated. @code{GLU_OUT_OF_MEMORY} indicates
8925f36f
AW
2811that there is not enough memory so no output is generated.
2812
2813@item @code{GLU_TESS_ERROR_DATA}
2814The same as the @code{GLU_TESS_ERROR} callback except that it takes an
f37e7e3d
DH
2815additional pointer argument. This pointer is identical to the opaque
2816pointer provided when @code{gluTessBeginPolygon} was called. The
8925f36f
AW
2817function prototype for this callback is:
2818
2819@end table
2820
2821@example
2822
2823void begin( GLenum type );
2824@end example
2825
2826@example
2827
2828void beginData( GLenum type, void *polygon_data );
2829@end example
2830
2831@example
2832
2833void edgeFlag( GLboolean flag );
2834@end example
2835
2836@example
2837
2838void edgeFlagData( GLboolean flag, void *polygon_data );
2839@end example
2840
2841@example
2842
2843void vertex( void *vertex_data );
2844@end example
2845
2846@example
2847
2848void vertexData( void *vertex_data, void *polygon_data );
2849@end example
2850
2851@example
2852
2853void end( void );
2854@end example
2855
2856@example
2857
2858void endData( void *polygon_data );
2859@end example
2860
2861@example
2862
2863void combine( GLdouble coords[3], void *vertex_data[4],
2864 GLfloat weight[4], void **outData );
2865@end example
2866
2867@example
2868
2869void myCombine( GLdouble coords[3], VERTEX *d[4],
2870 GLfloat w[4], VERTEX **dataOut )
2871@{
2872 VERTEX *new = new_vertex();
2873
2874 new->x = coords[0];
2875 new->y = coords[1];
2876 new->z = coords[2];
2877 new->r = w[0]*d[0]->r + w[1]*d[1]->r + w[2]*d[2]->r + w[3]*d[3]->r;
2878 new->g = w[0]*d[0]->g + w[1]*d[1]->g + w[2]*d[2]->g + w[3]*d[3]->g;
2879 new->b = w[0]*d[0]->b + w[1]*d[1]->b + w[2]*d[2]->b + w[3]*d[3]->b;
2880 new->a = w[0]*d[0]->a + w[1]*d[1]->a + w[2]*d[2]->a + w[3]*d[3]->a;
2881 *dataOut = new;
2882@}
2883@end example
2884
2885@example
2886
2887void combineData( GLdouble coords[3], void *vertex_data[4],
2888 GLfloat weight[4], void **outData,
2889 void *polygon_data );
2890@end example
2891
2892@example
2893
2894void error( GLenum errno );
2895@end example
2896
2897@example
2898
2899void errorData( GLenum errno, void *polygon_data );
2900@end example
2901
bb894c9d 2902@end deftypefun
8925f36f 2903
bb894c9d 2904@deftypefun void gluTessEndPolygon tess
3c9b6116
AW
2905Delimit a polygon description.
2906
8925f36f
AW
2907@table @asis
2908@item @var{tess}
2909Specifies the tessellation object (created with @code{gluNewTess}).
2910
2911@end table
2912
8925f36f 2913@code{gluTessBeginPolygon} and @code{gluTessEndPolygon} delimit the
f37e7e3d 2914definition of a convex, concave, or self-intersecting polygon. Within
8925f36f
AW
2915each @code{gluTessBeginPolygon}/@code{gluTessEndPolygon} pair, there
2916must be one or more calls to
f37e7e3d
DH
2917@code{gluTessBeginContour}/@code{gluTessEndContour}. Within each
2918contour, there are zero or more calls to @code{gluTessVertex}. The
8925f36f 2919vertices specify a closed contour (the last vertex of each contour is
f37e7e3d 2920automatically linked to the first). See the @code{gluTessVertex},
8925f36f
AW
2921@code{gluTessBeginContour}, and @code{gluTessEndContour} reference pages
2922for more details.
2923
2924Once @code{gluTessEndPolygon} is called, the polygon is tessellated, and
f37e7e3d 2925the resulting triangles are described through callbacks. See
8925f36f
AW
2926@code{gluTessCallback} for descriptions of the callback functions.
2927
bb894c9d 2928@end deftypefun
8925f36f 2929
bb894c9d 2930@deftypefun void gluTessNormal tess valueX valueY valueZ
3c9b6116
AW
2931Specify a normal for a polygon.
2932
8925f36f
AW
2933@table @asis
2934@item @var{tess}
2935Specifies the tessellation object (created with @code{gluNewTess}).
2936
2937@item @var{valueX}
2938Specifies the first component of the normal.
2939
2940@item @var{valueY}
2941Specifies the second component of the normal.
2942
2943@item @var{valueZ}
2944Specifies the third component of the normal.
2945
2946@end table
2947
8925f36f 2948@code{gluTessNormal} describes a normal for a polygon that the program
f37e7e3d
DH
2949is defining. All input data will be projected onto a plane perpendicular
2950to one of the three coordinate axes before tessellation and all output
2951triangles will be oriented CCW with respect to the normal (CW
2952orientation can be obtained by reversing the sign of the supplied
2953normal). For example, if you know that all polygons lie in the x-y
8925f36f
AW
2954plane, call @code{gluTessNormal}(tess, 0.0, 0.0, 1.0) before rendering
2955any polygons.
2956
2957If the supplied normal is (0.0, 0.0, 0.0) (the initial value), the
f37e7e3d 2958normal is determined as follows. The direction of the normal, up to its
8925f36f 2959sign, is found by fitting a plane to the vertices, without regard to how
f37e7e3d 2960the vertices are connected. It is expected that the input data lies
8925f36f 2961approximately in the plane; otherwise, projection perpendicular to one
f37e7e3d 2962of the three coordinate axes may substantially change the geometry. The
8925f36f
AW
2963sign of the normal is chosen so that the sum of the signed areas of all
2964input contours is nonnegative (where a CCW contour has positive area).
2965
2966The supplied normal persists until it is changed by another call to
2967@code{gluTessNormal}.
2968
bb894c9d 2969@end deftypefun
8925f36f 2970
bb894c9d 2971@deftypefun void gluTessProperty tess which data
3c9b6116
AW
2972Set a tessellation object property.
2973
8925f36f
AW
2974@table @asis
2975@item @var{tess}
2976Specifies the tessellation object (created with @code{gluNewTess}).
2977
2978@item @var{which}
f37e7e3d 2979Specifies the property to be set. Valid values are
8925f36f
AW
2980@code{GLU_TESS_WINDING_RULE}, @code{GLU_TESS_BOUNDARY_ONLY}, and
2981@code{GLU_TESS_TOLERANCE}.
2982
2983@item @var{data}
2984Specifies the value of the indicated property.
2985
2986@end table
2987
8925f36f 2988@code{gluTessProperty} is used to control properties stored in a
f37e7e3d
DH
2989tessellation object. These properties affect the way that the polygons
2990are interpreted and rendered. The legal values for @var{which} are as
8925f36f
AW
2991follows:
2992
2993@table @asis
2994@item @code{GLU_TESS_WINDING_RULE}
2995Determines which parts of the polygon are on the ``interior''.
2996@var{data} may be set to one of @code{GLU_TESS_WINDING_ODD},
2997@code{GLU_TESS_WINDING_NONZERO}, @code{GLU_TESS_WINDING_POSITIVE},
2998@code{GLU_TESS_WINDING_NEGATIVE}, or
2999@code{GLU_TESS_WINDING_ABS_GEQ_TWO}.
3000
3001To understand how the winding rule works, consider that the input
f37e7e3d 3002contours partition the plane into regions. The winding rule determines
8925f36f
AW
3003which of these regions are inside the polygon.
3004
3005For a single contour C, the winding number of a point x is simply the
3006signed number of revolutions we make around x as we travel once around C
f37e7e3d
DH
3007(where CCW is positive). When there are several contours, the individual
3008winding numbers are summed. This procedure associates a signed integer
3009value with each point x in the plane. Note that the winding number is
3010the same for all points in a single region.
8925f36f
AW
3011
3012The winding rule classifies a region as ``inside'' if its winding number
3013belongs to the chosen category (odd, nonzero, positive, negative, or
f37e7e3d
DH
3014absolute value of at least two). The previous GLU tessellator (prior to
3015GLU 1.2) used the ``odd'' rule. The ``nonzero'' rule is another common
3016way to define the interior. The other three rules are useful for polygon
3017CSG operations.
8925f36f
AW
3018
3019@item @code{GLU_TESS_BOUNDARY_ONLY}
3020Is a boolean value (``value'' should be set to GL_TRUE or GL_FALSE).
3021When set to GL_TRUE, a set of closed contours separating the polygon
f37e7e3d 3022interior and exterior are returned instead of a tessellation. Exterior
8925f36f 3023contours are oriented CCW with respect to the normal; interior contours
f37e7e3d 3024are oriented CW. The @code{GLU_TESS_BEGIN} and
8925f36f
AW
3025@code{GLU_TESS_BEGIN_DATA} callbacks use the type GL_LINE_LOOP for each
3026contour.
3027
3028@item @code{GLU_TESS_TOLERANCE}
3029Specifies a tolerance for merging features to reduce the size of the
f37e7e3d
DH
3030output. For example, two vertices that are very close to each other
3031might be replaced by a single vertex. The tolerance is multiplied by the
3032largest coordinate magnitude of any input vertex; this specifies the
8925f36f 3033maximum distance that any feature can move as the result of a single
f37e7e3d 3034merge operation. If a single feature takes part in several merge
8925f36f
AW
3035operations, the total distance moved could be larger.
3036
3037Feature merging is completely optional; the tolerance is only a hint.
3038The implementation is free to merge in some cases and not in others, or
f37e7e3d 3039to never merge features at all. The initial tolerance is 0.
8925f36f
AW
3040
3041The current implementation merges vertices only if they are exactly
f37e7e3d 3042coincident, regardless of the current tolerance. A vertex is spliced
8925f36f 3043into an edge only if the implementation is unable to distinguish which
f37e7e3d
DH
3044side of the edge the vertex lies on. Two edges are merged only when both
3045endpoints are identical.
8925f36f
AW
3046
3047@end table
3048
bb894c9d 3049@end deftypefun
8925f36f 3050
bb894c9d 3051@deftypefun void gluTessVertex tess location data
3c9b6116
AW
3052Specify a vertex on a polygon.
3053
8925f36f
AW
3054@table @asis
3055@item @var{tess}
3056Specifies the tessellation object (created with @code{gluNewTess}).
3057
3058@item @var{location}
3059Specifies the location of the vertex.
3060
3061@item @var{data}
3062Specifies an opaque pointer passed back to the program with the vertex
3063callback (as specified by @code{gluTessCallback}).
3064
3065@end table
3066
8925f36f 3067@code{gluTessVertex} describes a vertex on a polygon that the program
f37e7e3d
DH
3068defines. Successive @code{gluTessVertex} calls describe a closed
3069contour. For example, to describe a quadrilateral, @code{gluTessVertex}
3070should be called four times. @code{gluTessVertex} can only be called
8925f36f
AW
3071between @code{gluTessBeginContour} and @code{gluTessEndContour}.
3072
3073@var{data} normally points to a structure containing the vertex
3074location, as well as other per-vertex attributes such as color and
f37e7e3d 3075normal. This pointer is passed back to the user through the
8925f36f
AW
3076@code{GLU_TESS_VERTEX} or @code{GLU_TESS_VERTEX_DATA} callback after
3077tessellation (see the @code{gluTessCallback} reference page).
3078
bb894c9d 3079@end deftypefun
8925f36f 3080
bb894c9d 3081@deftypefun GLint gluUnProject4 winX winY winZ clipW model proj view nearVal farVal objX objY objZ objW
3c9b6116
AW
3082Map window and clip coordinates to object coordinates.
3083
8925f36f
AW
3084@table @asis
3085@item @var{winX}
3086@itemx @var{winY}
3087@itemx @var{winZ}
3088Specify the window coordinates to be mapped.
3089
3090@item @var{clipW}
3091Specify the clip w coordinate to be mapped.
3092
3093@item @var{model}
3094Specifies the modelview matrix (as from a @code{glGetDoublev} call).
3095
3096@item @var{proj}
3097Specifies the projection matrix (as from a @code{glGetDoublev} call).
3098
3099@item @var{view}
3100Specifies the viewport (as from a @code{glGetIntegerv} call).
3101
3102@item @var{nearVal}
3103@itemx @var{farVal}
3104Specifies the near and far planes (as from a @code{glGetDoublev} call).
3105
3106@item @var{objX}
3107@itemx @var{objY}
3108@itemx @var{objZ}
3109@itemx @var{objW}
3110Returns the computed object coordinates.
3111
3112@end table
3113
8925f36f
AW
3114@code{gluUnProject4} maps the specified window coordinatesi: @var{winX},
3115@var{winY}, and @var{winZ} and its clip w coordinate @var{clipW} into
3c9b6116 3116object coordinates @r{(@var{objX},@var{objY}@var{objZ}@var{objW})} using
f37e7e3d
DH
3117@var{model}, @var{proj}, and @var{view}. @var{clipW} can be other than 1
3118as for vertices in @code{glFeedbackBuffer} when data type
3119@code{GLU_4D_COLOR_TEXTURE} is returned. This also handles the case
8925f36f 3120where the @var{nearVal} and @var{farVal} planes are different from the
f37e7e3d 3121default, 0 and 1, respectively. A return value of @code{GLU_TRUE}
8925f36f
AW
3122indicates success; a return value of @code{GLU_FALSE} indicates failure.
3123
3124To compute the coordinates
3c9b6116 3125@r{(@var{objX},@var{objY}@var{objZ}@var{objW})}, @code{gluUnProject4}
8925f36f
AW
3126multiplies the normalized device coordinates by the inverse of
3127@var{model} * @var{proj} as follows:
3128
3c9b6116 3129@r{((@var{objX}), (@var{objY}), (@var{objZ}),
8925f36f
AW
3130(@var{objW}),)=@var{INV}⁡(@var{P}⁢@var{M},)⁢((2⁡(@var{winX}-@var{view}⁡[0,],),/@var{view}⁡[2,],-1),
3131(2⁡(@var{winY}-@var{view}⁡[1,],),/@var{view}⁡[3,],-1),
3132(2⁡(@var{winZ}-@var{nearVal},),/(@var{farVal}-@var{nearVal},),-1),
3133(@var{clipW}),)}
3134
3c9b6116 3135@r{@var{INV}} denotes matrix inversion.
8925f36f
AW
3136
3137@code{gluUnProject4} is equivalent to @code{gluUnProject} when
3138@var{clipW} is 1, @var{nearVal} is 0, and @var{farVal} is 1.
3139
bb894c9d 3140@end deftypefun
8925f36f 3141
bb894c9d 3142@deftypefun GLint gluUnProject winX winY winZ model proj view objX objY objZ
3c9b6116
AW
3143Map window coordinates to object coordinates.
3144
8925f36f
AW
3145@table @asis
3146@item @var{winX}
3147@itemx @var{winY}
3148@itemx @var{winZ}
3149Specify the window coordinates to be mapped.
3150
3151@item @var{model}
3152Specifies the modelview matrix (as from a @code{glGetDoublev} call).
3153
3154@item @var{proj}
3155Specifies the projection matrix (as from a @code{glGetDoublev} call).
3156
3157@item @var{view}
3158Specifies the viewport (as from a @code{glGetIntegerv} call).
3159
3160@item @var{objX}
3161@itemx @var{objY}
3162@itemx @var{objZ}
3163Returns the computed object coordinates.
3164
3165@end table
3166
8925f36f 3167@code{gluUnProject} maps the specified window coordinates into object
f37e7e3d
DH
3168coordinates using @var{model}, @var{proj}, and @var{view}. The result is
3169stored in @var{objX}, @var{objY}, and @var{objZ}. A return value of
8925f36f
AW
3170@code{GLU_TRUE} indicates success; a return value of @code{GLU_FALSE}
3171indicates failure.
3172
3c9b6116 3173To compute the coordinates @r{(@var{objX},@var{objY}@var{objZ})},
8925f36f
AW
3174@code{gluUnProject} multiplies the normalized device coordinates by the
3175inverse of @var{model} * @var{proj} as follows:
3176
3c9b6116 3177@r{((@var{objX}), (@var{objY}), (@var{objZ}),
8925f36f
AW
3178(@var{W}),)=@var{INV}⁡(@var{P}⁢@var{M},)⁢((2⁡(@var{winX}-@var{view}⁡[0,],),/@var{view}⁡[2,],-1),
3179(2⁡(@var{winY}-@var{view}⁡[1,],),/@var{view}⁡[3,],-1),
f37e7e3d 3180(2⁡(@var{winZ},)-1), (1),)}@r{@var{INV}} denotes matrix inversion. W is
3c9b6116 3181an unused variable, included for consistent matrix notation.
8925f36f 3182
bb894c9d 3183@end deftypefun
8925f36f
AW
3184
3185
3186@c %end of fragment