The functions from this section may be had by loading the module:
(use-modules (glu low-level)
This section of the manual was derived from the upstream OpenGL documentation. Each function’s documentation has its own copyright statement; for full details, see the upstream documentation. The copyright notices and licenses present in this section are as follows.
Copyright © 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/.
Delimit a NURBS curve definition.
Specifies the NURBS object (created with gluNewNurbsRenderer
).
Use gluBeginCurve
to mark the beginning of a NURBS curve
definition. After calling gluBeginCurve
, make one or more calls
to gluNurbsCurve
to define the attributes of the curve. Exactly
one of the calls to gluNurbsCurve
must have a curve type of
GLU_MAP1_VERTEX_3
or GLU_MAP1_VERTEX_4
. To mark the end
of the NURBS curve definition, call gluEndCurve
.
GL evaluators are used to render the NURBS curve as a series of line
segments. Evaluator state is preserved during rendering with
glPushAttrib
(GLU_EVAL_BIT
) and glPopAttrib
(). See
the glPushAttrib
reference page for details on exactly what state
these calls preserve.
Delimit a polygon description.
Specifies the tessellation object (created with gluNewTess
).
gluBeginPolygon
and gluEndPolygon
delimit the definition
of a nonconvex polygon. To define such a polygon, first call
gluBeginPolygon
. Then define the contours of the polygon by
calling gluTessVertex
for each vertex and gluNextContour
to start each new contour. Finally, call gluEndPolygon
to signal
the end of the definition. See the gluTessVertex
and
gluNextContour
reference pages for more details.
Once gluEndPolygon
is called, the polygon is tessellated, and the
resulting triangles are described through callbacks. See
gluTessCallback
for descriptions of the callback functions.
Delimit a NURBS surface definition.
Specifies the NURBS object (created with gluNewNurbsRenderer
).
Use gluBeginSurface
to mark the beginning of a NURBS surface
definition. After calling gluBeginSurface
, make one or more
calls to gluNurbsSurface
to define the attributes of the surface.
Exactly one of these calls to gluNurbsSurface
must have a surface
type of GLU_MAP2_VERTEX_3
or GLU_MAP2_VERTEX_4
. To mark
the end of the NURBS surface definition, call gluEndSurface
.
Trimming of NURBS surfaces is supported with gluBeginTrim
,
gluPwlCurve
, gluNurbsCurve
, and gluEndTrim
. See
the gluBeginTrim
reference page for details.
GL evaluators are used to render the NURBS surface as a set of polygons.
Evaluator state is preserved during rendering with
glPushAttrib
(GLU_EVAL_BIT
) and glPopAttrib
. See
the glPushAttrib
reference page for details on exactly what state
these calls preserve.
Delimit a NURBS trimming loop definition.
Specifies the NURBS object (created with gluNewNurbsRenderer
).
Use gluBeginTrim
to mark the beginning of a trimming loop and
gluEndTrim
to mark the end of a trimming loop. A trimming loop
is a set of oriented curve segments (forming a closed curve) that define
boundaries of a NURBS surface. You include these trimming loops in the
definition of a NURBS surface, between calls to gluBeginSurface
and gluEndSurface
.
The definition for a NURBS surface can contain many trimming loops. For
example, if you wrote a definition for a NURBS surface that resembled a
rectangle with a hole punched out, the definition would contain two
trimming loops. One loop would define the outer edge of the rectangle;
the other would define the hole punched out of the rectangle. The
definitions of each of these trimming loops would be bracketed by a
gluBeginTrim
/gluEndTrim
pair.
The definition of a single closed trimming loop can consist of multiple
curve segments, each described as a piecewise linear curve (see
gluPwlCurve
) or as a single NURBS curve (see
gluNurbsCurve
), or as a combination of both in any order. The
only library calls that can appear in a trimming loop definition
(between the calls to gluBeginTrim
and gluEndTrim
) are
gluPwlCurve
and gluNurbsCurve
.
The area of the NURBS surface that is displayed is the region in the domain to the left of the trimming curve as the curve parameter increases. Thus, the retained region of the NURBS surface is inside a counterclockwise trimming loop and outside a clockwise trimming loop. For the rectangle mentioned earlier, the trimming loop for the outer edge of the rectangle runs counterclockwise, while the trimming loop for the punched-out hole runs clockwise.
If you use more than one curve to define a single trimming loop, the
curve segments must form a closed loop (that is, the endpoint of each
curve must be the starting point of the next curve, and the endpoint of
the final curve must be the starting point of the first curve). If the
endpoints of the curve are sufficiently close together but not exactly
coincident, they will be coerced to match. If the endpoints are not
sufficiently close, an error results (see gluNurbsCallback
).
If a trimming loop definition contains multiple curves, the direction of the curves must be consistent (that is, the inside must be to the left of all of the curves). Nested trimming loops are legal as long as the curve orientations alternate correctly. If trimming curves are self-intersecting, or intersect one another, an error results.
If no trimming information is given for a NURBS surface, the entire surface is drawn.
Builds a subset of one-dimensional mipmap levels.
Specifies the target texture. Must be GLU_TEXTURE_1D
.
Requests the internal storage format of the texture image. The most
current version of the SGI implementation of GLU does not check this
value for validity before passing it on to the underlying OpenGL
implementation. A value that is not accepted by the OpenGL
implementation will lead to an OpenGL error. The benefit of not
checking this value at the GLU level is that OpenGL extensions can add
new internal texture formats without requiring a revision of the GLU
implementation. Older implementations of GLU check this value and raise
a GLU error if it is not 1, 2, 3, or 4 or one of the following symbolic
constants: GLU_ALPHA
, GLU_ALPHA4
, GLU_ALPHA8
,
GLU_ALPHA12
, GLU_ALPHA16
, GLU_LUMINANCE
,
GLU_LUMINANCE4
, GLU_LUMINANCE8
, GLU_LUMINANCE12
,
GLU_LUMINANCE16
, GLU_LUMINANCE_ALPHA
,
GLU_LUMINANCE4_ALPHA4
, GLU_LUMINANCE6_ALPHA2
,
GLU_LUMINANCE8_ALPHA8
, GLU_LUMINANCE12_ALPHA4
,
GLU_LUMINANCE12_ALPHA12
, GLU_LUMINANCE16_ALPHA16
,
GLU_INTENSITY
, GLU_INTENSITY4
, GLU_INTENSITY8
,
GLU_INTENSITY12
, GLU_INTENSITY16
, GLU_RGB
,
GLU_R3_G3_B2
, GLU_RGB4
, GLU_RGB5
, GLU_RGB8
,
GLU_RGB10
, GLU_RGB12
, GLU_RGB16
, GLU_RGBA
,
GLU_RGBA2
, GLU_RGBA4
, GLU_RGB5_A1
,
GLU_RGBA8
, GLU_RGB10_A2
, GLU_RGBA12
, or
GLU_RGBA16
.
Specifies the width in pixels of the texture image. This should be a power of 2.
Specifies the format of the pixel data. Must be one of:
GLU_COLOR_INDEX
, GLU_DEPTH_COMPONENT
, GLU_RED
,
GLU_GREEN
, GLU_BLUE
, GLU_ALPHA
, GLU_RGB
,
GLU_RGBA
, GLU_BGR
, GLU_BGRA
, GLU_LUMINANCE
,
or GLU_LUMINANCE_ALPHA
.
Specifies the data type for data. Must be one of:
GLU_UNSIGNED_BYTE
, GLU_BYTE
, GLU_BITMAP
,
GLU_UNSIGNED_SHORT
, GLU_SHORT
, GLU_UNSIGNED_INT
,
GLU_INT
, GLU_FLOAT
, GLU_UNSIGNED_BYTE_3_3_2
,
GLU_UNSIGNED_BYTE_2_3_3_REV
, GLU_UNSIGNED_SHORT_5_6_5
,
GLU_UNSIGNED_SHORT_5_6_5_REV
, GLU_UNSIGNED_SHORT_4_4_4_4
,
GLU_UNSIGNED_SHORT_4_4_4_4_REV
,
GLU_UNSIGNED_SHORT_5_5_5_1
,
GLU_UNSIGNED_SHORT_1_5_5_5_REV
, GLU_UNSIGNED_INT_8_8_8_8
,
GLU_UNSIGNED_INT_8_8_8_8_REV
, GLU_UNSIGNED_INT_10_10_10_2
,
or GLU_UNSIGNED_INT_2_10_10_10_REV
.
Specifies the mipmap level of the image data.
Specifies the minimum mipmap level to pass to glTexImage1D
.
Specifies the maximum mipmap level to pass to glTexImage1D
.
Specifies a pointer to the image data in memory.
gluBuild1DMipmapLevels
builds a subset of prefiltered
one-dimensional texture maps of decreasing resolutions called a mipmap.
This is used for the antialiasing of texture mapped primitives.
A return value of zero indicates success, otherwise a GLU error code is
returned (see gluErrorString
).
A series of mipmap levels from base to max is built by
decimating data in half until size 1Ã1 is reached. At each
level, each texel in the halved mipmap level is an average of the
corresponding two texels in the larger mipmap level. glTexImage1D
is called to load these mipmap levels from base to max. If
max is larger than the highest mipmap level for the texture of the
specified size, then a GLU error code is returned (see
gluErrorString
) and nothing is loaded.
For example, if level is 2 and width is 16, the following levels are possible: 16Ã1, 8Ã1, 4Ã1, 2Ã1, 1Ã1. These correspond to levels 2 through 6 respectively. If base is 3 and max is 5, then only mipmap levels 8Ã1, 4Ã1 and 2Ã1 are loaded. However, if max is 7, then an error is returned and nothing is loaded since max is larger than the highest mipmap level which is, in this case, 6.
The highest mipmap level can be derived from the formula log_2â¡(widthÃ2^level,).
See the glTexImage1D
reference page for a description of the
acceptable values for type parameter. See the glDrawPixels
reference page for a description of the acceptable values for
level parameter.
GLU_INVALID_VALUE
is returned if level > base,
base < 0, max < base or max is > the highest
mipmap level for data.
GLU_INVALID_VALUE
is returned if width is < 1.
GLU_INVALID_ENUM
is returned if internalFormat,
format, or type are not legal.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_BYTE_3_3_2
or GLU_UNSIGNED_BYTE_2_3_3_REV
and
format is not GLU_RGB
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_SHORT_5_6_5
or GLU_UNSIGNED_SHORT_5_6_5_REV
and format is not GLU_RGB
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_SHORT_4_4_4_4
or
GLU_UNSIGNED_SHORT_4_4_4_4_REV
and format is neither
GLU_RGBA
nor GLU_BGRA
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_SHORT_5_5_5_1
or
GLU_UNSIGNED_SHORT_1_5_5_5_REV
and format is neither
GLU_RGBA
nor GLU_BGRA
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_INT_8_8_8_8
or GLU_UNSIGNED_INT_8_8_8_8_REV
and format is neither GLU_RGBA
nor GLU_BGRA
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_INT_10_10_10_2
or
GLU_UNSIGNED_INT_2_10_10_10_REV
and format is neither
GLU_RGBA
nor GLU_BGRA
.
Builds a one-dimensional mipmap.
Specifies the target texture. Must be GLU_TEXTURE_1D
.
Requests the internal storage format of the texture image. The most
current version of the SGI implementation of GLU does not check this
value for validity before passing it on to the underlying OpenGL
implementation. A value that is not accepted by the OpenGL
implementation will lead to an OpenGL error. The benefit of not
checking this value at the GLU level is that OpenGL extensions can add
new internal texture formats without requiring a revision of the GLU
implementation. Older implementations of GLU check this value and raise
a GLU error if it is not 1, 2, 3, or 4 or one of the following symbolic
constants: GLU_ALPHA
, GLU_ALPHA4
, GLU_ALPHA8
,
GLU_ALPHA12
, GLU_ALPHA16
, GLU_LUMINANCE
,
GLU_LUMINANCE4
, GLU_LUMINANCE8
, GLU_LUMINANCE12
,
GLU_LUMINANCE16
, GLU_LUMINANCE_ALPHA
,
GLU_LUMINANCE4_ALPHA4
, GLU_LUMINANCE6_ALPHA2
,
GLU_LUMINANCE8_ALPHA8
, GLU_LUMINANCE12_ALPHA4
,
GLU_LUMINANCE12_ALPHA12
, GLU_LUMINANCE16_ALPHA16
,
GLU_INTENSITY
, GLU_INTENSITY4
, GLU_INTENSITY8
,
GLU_INTENSITY12
, GLU_INTENSITY16
, GLU_RGB
,
GLU_R3_G3_B2
, GLU_RGB4
, GLU_RGB5
, GLU_RGB8
,
GLU_RGB10
, GLU_RGB12
, GLU_RGB16
, GLU_RGBA
,
GLU_RGBA2
, GLU_RGBA4
, GLU_RGB5_A1
,
GLU_RGBA8
, GLU_RGB10_A2
, GLU_RGBA12
, or
GLU_RGBA16
.
Specifies the width, in pixels, of the texture image.
Specifies the format of the pixel data. Must be one of
GLU_COLOR_INDEX
, GLU_DEPTH_COMPONENT
, GLU_RED
,
GLU_GREEN
, GLU_BLUE
, GLU_ALPHA
, GLU_RGB
,
GLU_RGBA
, GLU_BGR
, GLU_BGRA
, GLU_LUMINANCE
,
or GLU_LUMINANCE_ALPHA
.
Specifies the data type for data. Must be one of
GLU_UNSIGNED_BYTE
, GLU_BYTE
, GLU_BITMAP
,
GLU_UNSIGNED_SHORT
, GLU_SHORT
, GLU_UNSIGNED_INT
,
GLU_INT
, GLU_FLOAT
, GLU_UNSIGNED_BYTE_3_3_2
,
GLU_UNSIGNED_BYTE_2_3_3_REV
, GLU_UNSIGNED_SHORT_5_6_5
,
GLU_UNSIGNED_SHORT_5_6_5_REV
, GLU_UNSIGNED_SHORT_4_4_4_4
,
GLU_UNSIGNED_SHORT_4_4_4_4_REV
,
GLU_UNSIGNED_SHORT_5_5_5_1
,
GLU_UNSIGNED_SHORT_1_5_5_5_REV
, GLU_UNSIGNED_INT_8_8_8_8
,
GLU_UNSIGNED_INT_8_8_8_8_REV
, GLU_UNSIGNED_INT_10_10_10_2
,
or GLU_UNSIGNED_INT_2_10_10_10_REV
.
Specifies a pointer to the image data in memory.
gluBuild1DMipmaps
builds a series of prefiltered one-dimensional
texture maps of decreasing resolutions called a mipmap. This is used
for the antialiasing of texture mapped primitives.
A return value of zero indicates success, otherwise a GLU error code is
returned (see gluErrorString
).
Initially, the width of data is checked to see if it is a power of 2. If not, a copy of data is scaled up or down to the nearest power of 2. (If width is exactly between powers of 2, then the copy of data will scale upwards.) This copy will be used for subsequent mipmapping operations described below. For example, if width is 57, then a copy of data will scale up to 64 before mipmapping takes place.
Then, proxy textures (see glTexImage1D
) are used to determine if
the implementation can fit the requested texture. If not, width
is continually halved until it fits.
Next, a series of mipmap levels is built by decimating a copy of data in half until size 1Ã1 is reached. At each level, each texel in the halved mipmap level is an average of the corresponding two texels in the larger mipmap level.
glTexImage1D
is called to load each of these mipmap levels. Level
0 is a copy of data. The highest level is
log_2,â¡(width,). For example, if width is 64 and
the implementation can store a texture of this size, the following
mipmap levels are built: 64Ã1, 32Ã1, 16Ã1, 8Ã1, 4Ã1,
2Ã1, and 1Ã1. These correspond to levels 0 through 6,
respectively.
See the glTexImage1D
reference page for a description of the
acceptable values for the type parameter. See the
glDrawPixels
reference page for a description of the acceptable
values for the data parameter.
GLU_INVALID_VALUE
is returned if width is < 1.
GLU_INVALID_ENUM
is returned if format or type are
not legal.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_BYTE_3_3_2
or GLU_UNSIGNED_BYTE_2_3_3_REV
and
format is not GLU_RGB
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_SHORT_5_6_5
or GLU_UNSIGNED_SHORT_5_6_5_REV
and format is not GLU_RGB
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_SHORT_4_4_4_4
or
GLU_UNSIGNED_SHORT_4_4_4_4_REV
and format is neither
GLU_RGBA
nor GLU_BGRA
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_SHORT_5_5_5_1
or
GLU_UNSIGNED_SHORT_1_5_5_5_REV
and format is neither
GLU_RGBA
nor GLU_BGRA
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_INT_8_8_8_8
or GLU_UNSIGNED_INT_8_8_8_8_REV
and format is neither GLU_RGBA
nor GLU_BGRA
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_INT_10_10_10_2
or
GLU_UNSIGNED_INT_2_10_10_10_REV
and format is neither
GLU_RGBA
nor GLU_BGRA
.
Builds a subset of two-dimensional mipmap levels.
Specifies the target texture. Must be GLU_TEXTURE_2D
.
Requests the internal storage format of the texture image. The most
current version of the SGI implementation of GLU does not check this
value for validity before passing it on to the underlying OpenGL
implementation. A value that is not accepted by the OpenGL
implementation will lead to an OpenGL error. The benefit of not
checking this value at the GLU level is that OpenGL extensions can add
new internal texture formats without requiring a revision of the GLU
implementation. Older implementations of GLU check this value and raise
a GLU error if it is not 1, 2, 3, or 4 or one of the following symbolic
constants: GLU_ALPHA
, GLU_ALPHA4
, GLU_ALPHA8
,
GLU_ALPHA12
, GLU_ALPHA16
, GLU_LUMINANCE
,
GLU_LUMINANCE4
, GLU_LUMINANCE8
, GLU_LUMINANCE12
,
GLU_LUMINANCE16
, GLU_LUMINANCE_ALPHA
,
GLU_LUMINANCE4_ALPHA4
, GLU_LUMINANCE6_ALPHA2
,
GLU_LUMINANCE8_ALPHA8
, GLU_LUMINANCE12_ALPHA4
,
GLU_LUMINANCE12_ALPHA12
, GLU_LUMINANCE16_ALPHA16
,
GLU_INTENSITY
, GLU_INTENSITY4
, GLU_INTENSITY8
,
GLU_INTENSITY12
, GLU_INTENSITY16
, GLU_RGB
,
GLU_R3_G3_B2
, GLU_RGB4
, GLU_RGB5
, GLU_RGB8
,
GLU_RGB10
, GLU_RGB12
, GLU_RGB16
, GLU_RGBA
,
GLU_RGBA2
, GLU_RGBA4
, GLU_RGB5_A1
,
GLU_RGBA8
, GLU_RGB10_A2
, GLU_RGBA12
, or
GLU_RGBA16
.
Specifies the width and height, respectively, in pixels of the texture image. These should be a power of 2.
Specifies the format of the pixel data. Must be one of
GLU_COLOR_INDEX
, GLU_DEPTH_COMPONENT
, GLU_RED
,
GLU_GREEN
, GLU_BLUE
, GLU_ALPHA
, GLU_RGB
,
GLU_RGBA
, GLU_BGR
, GLU_BGRA
, GLU_LUMINANCE
,
or GLU_LUMINANCE_ALPHA
.
Specifies the data type for data. Must be one of
GLU_UNSIGNED_BYTE
, GLU_BYTE
, GLU_BITMAP
,
GLU_UNSIGNED_SHORT
, GLU_SHORT
, GLU_UNSIGNED_INT
,
GLU_INT
, GLU_FLOAT
, GLU_UNSIGNED_BYTE_3_3_2
,
GLU_UNSIGNED_BYTE_2_3_3_REV
, GLU_UNSIGNED_SHORT_5_6_5
,
GLU_UNSIGNED_SHORT_5_6_5_REV
, GLU_UNSIGNED_SHORT_4_4_4_4
,
GLU_UNSIGNED_SHORT_4_4_4_4_REV
,
GLU_UNSIGNED_SHORT_5_5_5_1
,
GLU_UNSIGNED_SHORT_1_5_5_5_REV
, GLU_UNSIGNED_INT_8_8_8_8
,
GLU_UNSIGNED_INT_8_8_8_8_REV
, GLU_UNSIGNED_INT_10_10_10_2
,
or GLU_UNSIGNED_INT_2_10_10_10_REV
.
Specifies the mipmap level of the image data.
Specifies the minimum mipmap level to pass to glTexImage2D
.
Specifies the maximum mipmap level to pass to glTexImage2D
.
Specifies a pointer to the image data in memory.
gluBuild2DMipmapLevels
builds a subset of prefiltered
two-dimensional texture maps of decreasing resolutions called a mipmap.
This is used for the antialiasing of texture mapped primitives.
A return value of zero indicates success, otherwise a GLU error code is
returned (see gluErrorString
).
A series of mipmap levels from base to max is built by
decimating data in half along both dimensions until size 1Ã1
is reached. At each level, each texel in the halved mipmap level is an
average of the corresponding four texels in the larger mipmap level. (In
the case of rectangular images, the decimation will ultimately reach an
NÃ1 or 1ÃN configuration. Here, two texels are
averaged instead.) glTexImage2D
is called to load these mipmap
levels from base to max. If max is larger than the
highest mipmap level for the texture of the specified size, then a GLU
error code is returned (see gluErrorString
) and nothing is
loaded.
For example, if level is 2 and width is 16 and height is 8, the following levels are possible: 16Ã8, 8Ã4, 4Ã2, 2Ã1, 1Ã1. These correspond to levels 2 through 6 respectively. If base is 3 and max is 5, then only mipmap levels 8Ã4, 4Ã2, and 2Ã1 are loaded. However, if max is 7, then an error is returned and nothing is loaded since max is larger than the highest mipmap level which is, in this case, 6.
The highest mipmap level can be derived from the formula log_2â¡(maxâ¡(width,height)Ã2^level,).
See the glTexImage1D
reference page for a description of the
acceptable values for format parameter. See the
glDrawPixels
reference page for a description of the acceptable
values for type parameter.
GLU_INVALID_VALUE
is returned if level > base,
base < 0, max < base, or max is > the highest
mipmap level for data.
GLU_INVALID_VALUE
is returned if width or height is <
1.
GLU_INVALID_ENUM
is returned if internalFormat,
format, or type is not legal.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_BYTE_3_3_2
or GLU_UNSIGNED_BYTE_2_3_3_REV
and
format is not GLU_RGB
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_SHORT_5_6_5
or GLU_UNSIGNED_SHORT_5_6_5_REV
and format is not GLU_RGB
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_SHORT_4_4_4_4
or
GLU_UNSIGNED_SHORT_4_4_4_4_REV
and format is neither
GLU_RGBA
nor GLU_BGRA
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_SHORT_5_5_5_1
or
GLU_UNSIGNED_SHORT_1_5_5_5_REV
and format is neither
GLU_RGBA
nor GLU_BGRA
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_INT_8_8_8_8
or GLU_UNSIGNED_INT_8_8_8_8_REV
and format is neither GLU_RGBA
nor GLU_BGRA
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_INT_10_10_10_2
or
GLU_UNSIGNED_INT_2_10_10_10_REV
and format is neither
GLU_RGBA
nor GLU_BGRA
.
Builds a two-dimensional mipmap.
Specifies the target texture. Must be GLU_TEXTURE_2D
.
Requests the internal storage format of the texture image. The most
current version of the SGI implementation of GLU does not check this
value for validity before passing it on to the underlying OpenGL
implementation. A value that is not accepted by the OpenGL
implementation will lead to an OpenGL error. The benefit of not
checking this value at the GLU level is that OpenGL extensions can add
new internal texture formats without requiring a revision of the GLU
implementation. Older implementations of GLU check this value and raise
a GLU error if it is not 1, 2, 3, or 4 or one of the following symbolic
constants: GLU_ALPHA
, GLU_ALPHA4
, GLU_ALPHA8
,
GLU_ALPHA12
, GLU_ALPHA16
, GLU_LUMINANCE
,
GLU_LUMINANCE4
, GLU_LUMINANCE8
, GLU_LUMINANCE12
,
GLU_LUMINANCE16
, GLU_LUMINANCE_ALPHA
,
GLU_LUMINANCE4_ALPHA4
, GLU_LUMINANCE6_ALPHA2
,
GLU_LUMINANCE8_ALPHA8
, GLU_LUMINANCE12_ALPHA4
,
GLU_LUMINANCE12_ALPHA12
, GLU_LUMINANCE16_ALPHA16
,
GLU_INTENSITY
, GLU_INTENSITY4
, GLU_INTENSITY8
,
GLU_INTENSITY12
, GLU_INTENSITY16
, GLU_RGB
,
GLU_R3_G3_B2
, GLU_RGB4
, GLU_RGB5
, GLU_RGB8
,
GLU_RGB10
, GLU_RGB12
, GLU_RGB16
, GLU_RGBA
,
GLU_RGBA2
, GLU_RGBA4
, GLU_RGB5_A1
,
GLU_RGBA8
, GLU_RGB10_A2
, GLU_RGBA12
, or
GLU_RGBA16
.
Specifies in pixels the width and height, respectively, of the texture image.
Specifies the format of the pixel data. Must be one of
GLU_COLOR_INDEX
, GLU_DEPTH_COMPONENT
, GLU_RED
,
GLU_GREEN
, GLU_BLUE
, GLU_ALPHA
, GLU_RGB
,
GLU_RGBA
, GLU_BGR
, GLU_BGRA
, GLU_LUMINANCE
,
or GLU_LUMINANCE_ALPHA
.
Specifies the data type for data. Must be one of
GLU_UNSIGNED_BYTE
, GLU_BYTE
, GLU_BITMAP
,
GLU_UNSIGNED_SHORT
, GLU_SHORT
, GLU_UNSIGNED_INT
,
GLU_INT
, GLU_FLOAT
, GLU_UNSIGNED_BYTE_3_3_2
,
GLU_UNSIGNED_BYTE_2_3_3_REV
, GLU_UNSIGNED_SHORT_5_6_5
,
GLU_UNSIGNED_SHORT_5_6_5_REV
, GLU_UNSIGNED_SHORT_4_4_4_4
,
GLU_UNSIGNED_SHORT_4_4_4_4_REV
,
GLU_UNSIGNED_SHORT_5_5_5_1
,
GLU_UNSIGNED_SHORT_1_5_5_5_REV
, GLU_UNSIGNED_INT_8_8_8_8
,
GLU_UNSIGNED_INT_8_8_8_8_REV
, GLU_UNSIGNED_INT_10_10_10_2
,
or GLU_UNSIGNED_INT_2_10_10_10_REV
.
Specifies a pointer to the image data in memory.
gluBuild2DMipmaps
builds a series of prefiltered two-dimensional
texture maps of decreasing resolutions called a mipmap. This is used
for the antialiasing of texture-mapped primitives.
A return value of zero indicates success, otherwise a GLU error code is
returned (see gluErrorString
).
Initially, the width and height of data are checked to see if they are a power of 2. If not, a copy of data (not data), is scaled up or down to the nearest power of 2. This copy will be used for subsequent mipmapping operations described below. (If width or height is exactly between powers of 2, then the copy of data will scale upwards.) For example, if width is 57 and height is 23, then a copy of data will scale up to 64 in width and down to 16 in depth, before mipmapping takes place.
Then, proxy textures (see glTexImage2D
) are used to determine if
the implementation can fit the requested texture. If not, both
dimensions are continually halved until it fits. (If the OpenGL version
is \(<= 1.0, both maximum texture dimensions are clamped to the value
returned by glGetIntegerv
with the argument
GLU_MAX_TEXTURE_SIZE
.)
Next, a series of mipmap levels is built by decimating a copy of data in half along both dimensions until size 1Ã1 is reached. At each level, each texel in the halved mipmap level is an average of the corresponding four texels in the larger mipmap level. (In the case of rectangular images, the decimation will ultimately reach an NÃ1 or 1ÃN configuration. Here, two texels are averaged instead.)
glTexImage2D
is called to load each of these mipmap levels. Level
0 is a copy of data. The highest level is
log_2,â¡(maxâ¡(width,height),). For example,
if width is 64 and height is 16 and the implementation can
store a texture of this size, the following mipmap levels are built:
64Ã16, 32Ã8, 16Ã4, 8Ã2, 4Ã1, 2Ã1, and 1Ã1
These correspond to levels 0 through 6, respectively.
See the glTexImage1D
reference page for a description of the
acceptable values for format parameter. See the
glDrawPixels
reference page for a description of the acceptable
values for type parameter.
GLU_INVALID_VALUE
is returned if width or height is <
1.
GLU_INVALID_ENUM
is returned if internalFormat,
format, or type is not legal.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_BYTE_3_3_2
or GLU_UNSIGNED_BYTE_2_3_3_REV
and
format is not GLU_RGB
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_SHORT_5_6_5
or GLU_UNSIGNED_SHORT_5_6_5_REV
and format is not GLU_RGB
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_SHORT_4_4_4_4
or
GLU_UNSIGNED_SHORT_4_4_4_4_REV
and format is neither
GLU_RGBA
nor GLU_BGRA
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_SHORT_5_5_5_1
or
GLU_UNSIGNED_SHORT_1_5_5_5_REV
and format is neither
GLU_RGBA
nor GLU_BGRA
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_INT_8_8_8_8
or GLU_UNSIGNED_INT_8_8_8_8_REV
and format is neither GLU_RGBA
nor GLU_BGRA
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_INT_10_10_10_2
or
GLU_UNSIGNED_INT_2_10_10_10_REV
and format is neither
GLU_RGBA
nor GLU_BGRA
.
Builds a subset of three-dimensional mipmap levels.
Specifies the target texture. Must be GLU_TEXTURE_3D
.
Requests the internal storage format of the texture image. The most
current version of the SGI implementation of GLU does not check this
value for validity before passing it on to the underlying OpenGL
implementation. A value that is not accepted by the OpenGL
implementation will lead to an OpenGL error. The benefit of not
checking this value at the GLU level is that OpenGL extensions can add
new internal texture formats without requiring a revision of the GLU
implementation. Older implementations of GLU check this value and raise
a GLU error if it is not 1, 2, 3, or 4 or one of the following symbolic
constants: GLU_ALPHA
, GLU_ALPHA4
, GLU_ALPHA8
,
GLU_ALPHA12
, GLU_ALPHA16
, GLU_LUMINANCE
,
GLU_LUMINANCE4
, GLU_LUMINANCE8
, GLU_LUMINANCE12
,
GLU_LUMINANCE16
, GLU_LUMINANCE_ALPHA
,
GLU_LUMINANCE4_ALPHA4
, GLU_LUMINANCE6_ALPHA2
,
GLU_LUMINANCE8_ALPHA8
, GLU_LUMINANCE12_ALPHA4
,
GLU_LUMINANCE12_ALPHA12
, GLU_LUMINANCE16_ALPHA16
,
GLU_INTENSITY
, GLU_INTENSITY4
, GLU_INTENSITY8
,
GLU_INTENSITY12
, GLU_INTENSITY16
, GLU_RGB
,
GLU_R3_G3_B2
, GLU_RGB4
, GLU_RGB5
, GLU_RGB8
,
GLU_RGB10
, GLU_RGB12
, GLU_RGB16
, GLU_RGBA
,
GLU_RGBA2
, GLU_RGBA4
, GLU_RGB5_A1
,
GLU_RGBA8
, GLU_RGB10_A2
, GLU_RGBA12
, or
GLU_RGBA16
.
Specifies in pixels the width, height and depth respectively, of the texture image. These should be a power of 2.
Specifies the format of the pixel data. Must be one of
GLU_COLOR_INDEX
, GLU_DEPTH_COMPONENT
, GLU_RED
,
GLU_GREEN
, GLU_BLUE
, GLU_ALPHA
, GLU_RGB
,
GLU_RGBA
, GLU_BGR
, GLU_BGRA
, GLU_LUMINANCE
,
or GLU_LUMINANCE_ALPHA
.
Specifies the data type for data. Must be one of
GLU_UNSIGNED_BYTE
, GLU_BYTE
, GLU_BITMAP
,
GLU_UNSIGNED_SHORT
, GLU_SHORT
, GLU_UNSIGNED_INT
,
GLU_INT
, GLU_FLOAT
, GLU_UNSIGNED_BYTE_3_3_2
,
GLU_UNSIGNED_BYTE_2_3_3_REV
, GLU_UNSIGNED_SHORT_5_6_5
,
GLU_UNSIGNED_SHORT_5_6_5_REV
, GLU_UNSIGNED_SHORT_4_4_4_4
,
GLU_UNSIGNED_SHORT_4_4_4_4_REV
,
GLU_UNSIGNED_SHORT_5_5_5_1
,
GLU_UNSIGNED_SHORT_1_5_5_5_REV
, GLU_UNSIGNED_INT_8_8_8_8
,
GLU_UNSIGNED_INT_8_8_8_8_REV
, GLU_UNSIGNED_INT_10_10_10_2
,
or GLU_UNSIGNED_INT_2_10_10_10_REV
.
Specifies the mipmap level of the image data.
Specifies the minimum mipmap level to pass to glTexImage3D
.
Specifies the maximum mipmap level to pass to glTexImage3D
.
Specifies a pointer to the image data in memory.
gluBuild3DMipmapLevels
builds a subset of prefiltered
three-dimensional texture maps of decreasing resolutions called a
mipmap. This is used for the antialiasing of texture mapped primitives.
A return value of zero indicates success, otherwise a GLU error code is
returned (see gluErrorString
).
A series of mipmap levels from base to max is built by
decimating data in half along both dimensions until size 1Ã1Ã1
is reached. At each level, each texel in the halved mipmap level is an
average of the corresponding eight texels in the larger mipmap level.
(If exactly one of the dimensions is 1, four texels are averaged. If
exactly two of the dimensions are 1, two texels are averaged.)
glTexImage3D
is called to load these mipmap levels from
base to max. If max is larger than the highest mipmap
level for the texture of the specified size, then a GLU error code is
returned (see gluErrorString
) and nothing is loaded.
For example, if level is 2 and width is 16, height is 8 and depth is 4, the following levels are possible: 16Ã8Ã4, 8Ã4Ã2, 4Ã2Ã1, 2Ã1Ã1, 1Ã1Ã1. These correspond to levels 2 through 6 respectively. If base is 3 and max is 5, then only mipmap levels 8Ã4Ã2, 4Ã2Ã1, and 2Ã1Ã1 are loaded. However, if max is 7, then an error is returned and nothing is loaded, since max is larger than the highest mipmap level which is, in this case, 6.
The highest mipmap level can be derived from the formula log_2â¡(maxâ¡(width,heightdepth)Ã2^level,).
See the glTexImage1D
reference page for a description of the
acceptable values for format parameter. See the
glDrawPixels
reference page for a description of the acceptable
values for type parameter.
GLU_INVALID_VALUE
is returned if level > base,
base < 0, max < base, or max is > the highest
mipmap level for data.
GLU_INVALID_VALUE
is returned if width, height, or
depth is < 1.
GLU_INVALID_ENUM
is returned if internalFormat,
format, or type is not legal.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_BYTE_3_3_2
or GLU_UNSIGNED_BYTE_2_3_3_REV
and
format is not GLU_RGB
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_SHORT_5_6_5
or GLU_UNSIGNED_SHORT_5_6_5_REV
and format is not GLU_RGB
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_SHORT_4_4_4_4
or
GLU_UNSIGNED_SHORT_4_4_4_4_REV
and format is neither
GLU_RGBA
nor GLU_BGRA
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_SHORT_5_5_5_1
or
GLU_UNSIGNED_SHORT_1_5_5_5_REV
and format is neither
GLU_RGBA
nor GLU_BGRA
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_INT_8_8_8_8
or GLU_UNSIGNED_INT_8_8_8_8_REV
and format is neither GLU_RGBA
nor GLU_BGRA
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_INT_10_10_10_2
or
GLU_UNSIGNED_INT_2_10_10_10_REV
and format is neither
GLU_RGBA
nor GLU_BGRA
.
Builds a three-dimensional mipmap.
Specifies the target texture. Must be GLU_TEXTURE_3D
.
Requests the internal storage format of the texture image. The most
current version of the SGI implementation of GLU does not check this
value for validity before passing it on to the underlying OpenGL
implementation. A value that is not accepted by the OpenGL
implementation will lead to an OpenGL error. The benefit of not
checking this value at the GLU level is that OpenGL extensions can add
new internal texture formats without requiring a revision of the GLU
implementation. Older implementations of GLU check this value and raise
a GLU error if it is not 1, 2, 3, or 4 or one of the following symbolic
constants: GLU_ALPHA
, GLU_ALPHA4
, GLU_ALPHA8
,
GLU_ALPHA12
, GLU_ALPHA16
, GLU_LUMINANCE
,
GLU_LUMINANCE4
, GLU_LUMINANCE8
, GLU_LUMINANCE12
,
GLU_LUMINANCE16
, GLU_LUMINANCE_ALPHA
,
GLU_LUMINANCE4_ALPHA4
, GLU_LUMINANCE6_ALPHA2
,
GLU_LUMINANCE8_ALPHA8
, GLU_LUMINANCE12_ALPHA4
,
GLU_LUMINANCE12_ALPHA12
, GLU_LUMINANCE16_ALPHA16
,
GLU_INTENSITY
, GLU_INTENSITY4
, GLU_INTENSITY8
,
GLU_INTENSITY12
, GLU_INTENSITY16
, GLU_RGB
,
GLU_R3_G3_B2
, GLU_RGB4
, GLU_RGB5
, GLU_RGB8
,
GLU_RGB10
, GLU_RGB12
, GLU_RGB16
, GLU_RGBA
,
GLU_RGBA2
, GLU_RGBA4
, GLU_RGB5_A1
,
GLU_RGBA8
, GLU_RGB10_A2
, GLU_RGBA12
, or
GLU_RGBA16
.
Specifies in pixels the width, height and depth respectively, in pixels of the texture image.
Specifies the format of the pixel data. Must be one of
GLU_COLOR_INDEX
, GLU_DEPTH_COMPONENT
, GLU_RED
,
GLU_GREEN
, GLU_BLUE
, GLU_ALPHA
, GLU_RGB
,
GLU_RGBA
, GLU_BGR
, GLU_BGRA
, GLU_LUMINANCE
,
or GLU_LUMINANCE_ALPHA
.
Specifies the data type for data. Must be one of:
GLU_UNSIGNED_BYTE
, GLU_BYTE
, GLU_BITMAP
,
GLU_UNSIGNED_SHORT
, GLU_SHORT
, GLU_UNSIGNED_INT
,
GLU_INT
, GLU_FLOAT
, GLU_UNSIGNED_BYTE_3_3_2
,
GLU_UNSIGNED_BYTE_2_3_3_REV
, GLU_UNSIGNED_SHORT_5_6_5
,
GLU_UNSIGNED_SHORT_5_6_5_REV
, GLU_UNSIGNED_SHORT_4_4_4_4
,
GLU_UNSIGNED_SHORT_4_4_4_4_REV
,
GLU_UNSIGNED_SHORT_5_5_5_1
,
GLU_UNSIGNED_SHORT_1_5_5_5_REV
, GLU_UNSIGNED_INT_8_8_8_8
,
GLU_UNSIGNED_INT_8_8_8_8_REV
, GLU_UNSIGNED_INT_10_10_10_2
,
or GLU_UNSIGNED_INT_2_10_10_10_REV
.
Specifies a pointer to the image data in memory.
gluBuild3DMipmaps
builds a series of prefiltered
three-dimensional texture maps of decreasing resolutions called a
mipmap. This is used for the antialiasing of texture-mapped primitives.
A return value of zero indicates success, otherwise a GLU error code is
returned (see gluErrorString
).
Initially, the width, height and depth of data are checked to see if they are a power of 2. If not, a copy of data is made and scaled up or down to the nearest power of 2. (If width, height, or depth is exactly between powers of 2, then the copy of data will scale upwards.) This copy will be used for subsequent mipmapping operations described below. For example, if width is 57, height is 23, and depth is 24, then a copy of data will scale up to 64 in width, down to 16 in height, and up to 32 in depth before mipmapping takes place.
Then, proxy textures (see glTexImage3D
) are used to determine if
the implementation can fit the requested texture. If not, all three
dimensions are continually halved until it fits.
Next, a series of mipmap levels is built by decimating a copy of data in half along all three dimensions until size 1Ã1Ã1 is reached. At each level, each texel in the halved mipmap level is an average of the corresponding eight texels in the larger mipmap level. (If exactly one of the dimensions is 1, four texels are averaged. If exactly two of the dimensions are 1, two texels are averaged.)
glTexImage3D
is called to load each of these mipmap levels. Level
0 is a copy of data. The highest level is
log_2,â¡(maxâ¡(width,heightdepth),). For
example, if width is 64, height is 16, and depth is
32, and the implementation can store a texture of this size, the
following mipmap levels are built: 64Ã16Ã32, 32Ã8Ã16,
16Ã4Ã8, 8Ã2Ã4, 4Ã1Ã2, 2Ã1Ã1, and 1Ã1Ã1. These
correspond to levels 0 through 6, respectively.
See the glTexImage1D
reference page for a description of the
acceptable values for format parameter. See the
glDrawPixels
reference page for a description of the acceptable
values for type parameter.
GLU_INVALID_VALUE
is returned if width, height, or
depth is < 1.
GLU_INVALID_ENUM
is returned if internalFormat,
format, or type is not legal.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_BYTE_3_3_2
or GLU_UNSIGNED_BYTE_2_3_3_REV
and
format is not GLU_RGB
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_SHORT_5_6_5
or GLU_UNSIGNED_SHORT_5_6_5_REV
and format is not GLU_RGB
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_SHORT_4_4_4_4
or
GLU_UNSIGNED_SHORT_4_4_4_4_REV
and format is neither
GLU_RGBA
nor GLU_BGRA
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_SHORT_5_5_5_1
or
GLU_UNSIGNED_SHORT_1_5_5_5_REV
and format is neither
GLU_RGBA
nor GLU_BGRA
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_INT_8_8_8_8
or GLU_UNSIGNED_INT_8_8_8_8_REV
and format is neither GLU_RGBA
nor GLU_BGRA
.
GLU_INVALID_OPERATION
is returned if type is
GLU_UNSIGNED_INT_10_10_10_2
or
GLU_UNSIGNED_INT_2_10_10_10_REV
and format is neither
GLU_RGBA
nor GLU_BGRA
.
Determines if an extension name is supported.
Specifies an extension name.
Specifies a space-separated list of extension names supported.
gluCheckExtension
returns GLU_TRUE
if extName is
supported otherwise GLU_FALSE
is returned.
This is used to check for the presence for OpenGL, GLU, or GLX extension
names by passing the extension strings returned by glGetString
,
gluGetString
, glXGetClientString
,
glXQueryExtensionsString
, or glXQueryServerString
,
respectively, as extString.
Draw a cylinder.
Specifies the quadrics object (created with gluNewQuadric
).
Specifies the radius of the cylinder at z = 0.
Specifies the radius of the cylinder at z = height.
Specifies the height of the cylinder.
Specifies the number of subdivisions around the z axis.
Specifies the number of subdivisions along the z axis.
gluCylinder
draws a cylinder oriented along the z axis. The
base of the cylinder is placed at z = 0 and the top at
z=height. Like a sphere, a cylinder is subdivided
around the z axis into slices and along the z axis into
stacks.
Note that if top is set to 0.0, this routine generates a cone.
If the orientation is set to GLU_OUTSIDE
(with
gluQuadricOrientation
), then any generated normals point away
from the z axis. Otherwise, they point toward the z axis.
If texturing is turned on (with gluQuadricTexture
), then texture
coordinates are generated so that t ranges linearly from 0.0 at
z = 0 to 1.0 at z = height, and s ranges from
0.0 at the +y axis, to 0.25 at the +x axis, to 0.5 at the
-y axis, to 0.75 at the \-x axis, and back to 1.0 at the
+y axis.
Destroy a NURBS object.
Specifies the NURBS object to be destroyed.
gluDeleteNurbsRenderer
destroys the NURBS object (which was
created with gluNewNurbsRenderer
) and frees any memory it uses.
Once gluDeleteNurbsRenderer
has been called, nurb cannot be
used again.
Destroy a quadrics object.
Specifies the quadrics object to be destroyed.
gluDeleteQuadric
destroys the quadrics object (created with
gluNewQuadric
) and frees any memory it uses. Once
gluDeleteQuadric
has been called, quad cannot be used
again.
Destroy a tessellation object.
Specifies the tessellation object to destroy.
gluDeleteTess
destroys the indicated tessellation object (which
was created with gluNewTess
) and frees any memory that it used.
Draw a disk.
Specifies the quadrics object (created with gluNewQuadric
).
Specifies the inner radius of the disk (may be 0).
Specifies the outer radius of the disk.
Specifies the number of subdivisions around the z axis.
Specifies the number of concentric rings about the origin into which the disk is subdivided.
gluDisk
renders a disk on the z = 0 plane. The disk has a
radius of outer and contains a concentric circular hole with a
radius of inner. If inner is 0, then no hole is generated.
The disk is subdivided around the z axis into slices (like pizza
slices) and also about the z axis into rings (as specified by
slices and loops, respectively).
With respect to orientation, the +z side of the disk is considered
to be “outside” (see gluQuadricOrientation
). This means that
if the orientation is set to GLU_OUTSIDE
, then any normals
generated point along the +z axis. Otherwise, they point along
the \-z axis.
If texturing has been turned on (with gluQuadricTexture
), texture
coordinates are generated linearly such that where
r=outer, the value at (r, 0, 0) is (1, 0.5), at
(0, r, 0) it is (0.5, 1), at (\-r, 0, 0) it is (0, 0.5), and
at (0, \-r, 0) it is (0.5, 0).
Produce an error string from a GL or GLU error code.
Specifies a GL or GLU error code.
gluErrorString
produces an error string from a GL or GLU error
code. The string is in ISO Latin 1 format. For example,
gluErrorString
(GLU_OUT_OF_MEMORY
) returns the string
out of memory.
The standard GLU error codes are GLU_INVALID_ENUM
,
GLU_INVALID_VALUE
, and GLU_OUT_OF_MEMORY
. Certain other
GLU functions can return specialized error codes through callbacks. See
the glGetError
reference page for the list of GL error codes.
NULL
is returned if error is not a valid GL or GLU error
code.
Get a NURBS property.
Specifies the NURBS object (created with gluNewNurbsRenderer
).
Specifies the property whose value is to be fetched. Valid values are
GLU_CULLING
, GLU_SAMPLING_TOLERANCE
,
GLU_DISPLAY_MODE
, GLU_AUTO_LOAD_MATRIX
,
GLU_PARAMETRIC_TOLERANCE
, GLU_SAMPLING_METHOD
,
GLU_U_STEP
, GLU_V_STEP
, and GLU_NURBS_MODE
.
Specifies a pointer to the location into which the value of the named property is written.
gluGetNurbsProperty
retrieves properties stored in a NURBS
object. These properties affect the way that NURBS curves and surfaces
are rendered. See the gluNurbsProperty
reference page for
information about what the properties are and what they do.
Return a string describing the GLU version or GLU extensions .
Specifies a symbolic constant, one of GLU_VERSION
, or
GLU_EXTENSIONS
.
gluGetString
returns a pointer to a static string describing the
GLU version or the GLU extensions that are supported.
The version number is one of the following forms:
major_number.minor_numbermajor_number.minor_number.release_number.
The version string is of the following form:
version number<space>vendor-specific information
Vendor-specific information is optional. Its format and contents depend on the implementation.
The standard GLU contains a basic set of features and capabilities. If
a company or group of companies wish to support other features, these
may be included as extensions to the GLU. If name is
GLU_EXTENSIONS
, then gluGetString
returns a
space-separated list of names of supported GLU extensions. (Extension
names never contain spaces.)
All strings are null-terminated.
NULL is returned if name is not GLU_VERSION
or
GLU_EXTENSIONS
.
Get a tessellation object property.
Specifies the tessellation object (created with gluNewTess
).
Specifies the property whose value is to be fetched. Valid values are
GLU_TESS_WINDING_RULE
, GLU_TESS_BOUNDARY_ONLY
, and
GLU_TESS_TOLERANCE
.
Specifies a pointer to the location into which the value of the named property is written.
gluGetTessProperty
retrieves properties stored in a tessellation
object. These properties affect the way that tessellation objects are
interpreted and rendered. See the gluTessProperty
reference page
for information about the properties and what they do.
Load NURBS sampling and culling matrices.
Specifies the NURBS object (created with gluNewNurbsRenderer
).
Specifies a modelview matrix (as from a glGetFloatv
call).
Specifies a projection matrix (as from a glGetFloatv
call).
Specifies a viewport (as from a glGetIntegerv
call).
gluLoadSamplingMatrices
uses model, perspective, and
view to recompute the sampling and culling matrices stored in
nurb. The sampling matrix determines how finely a NURBS curve or
surface must be tessellated to satisfy the sampling tolerance (as
determined by the GLU_SAMPLING_TOLERANCE
property). The culling
matrix is used in deciding if a NURBS curve or surface should be culled
before rendering (when the GLU_CULLING
property is turned on).
gluLoadSamplingMatrices
is necessary only if the
GLU_AUTO_LOAD_MATRIX
property is turned off (see
gluNurbsProperty
). Although it can be convenient to leave the
GLU_AUTO_LOAD_MATRIX
property turned on, there can be a
performance penalty for doing so. (A round trip to the GL server is
needed to fetch the current values of the modelview matrix, projection
matrix, and viewport.)
Define a viewing transformation.
Specifies the position of the eye point.
Specifies the position of the reference point.
Specifies the direction of the up vector.
gluLookAt
creates a viewing matrix derived from an eye point, a
reference point indicating the center of the scene, and an UP
vector.
The matrix maps the reference point to the negative z axis and the eye point to the origin. When a typical projection matrix is used, the center of the scene therefore maps to the center of the viewport. Similarly, the direction described by the UP vector projected onto the viewing plane is mapped to the positive y axis so that it points upward in the viewport. The UP vector must not be parallel to the line of sight from the eye point to the reference point.
Let
F=((centerX-eyeX), (centerY-eyeY), (centerZ-eyeZ),)
Let UP be the vector (upX,upYupZ).
Then normalize as follows: f=F/â¥F,â¥,
UP^â³=UP/â¥UP,â¥,
Finally, let s=fÃUP^â³, and u=sÃf.
M is then constructed as follows: M=((sâ¡[0,] sâ¡[1,] sâ¡[2,] 0), (uâ¡[0,] uâ¡[1,] uâ¡[2,] 0), (-fâ¡[0,] -fâ¡[1,] -fâ¡[2,] 0), (0 0 0 1),)
and gluLookAt
is equivalent to
glMultMatrixf(M); glTranslated(-eyex, -eyey, -eyez);
Create a NURBS object.
gluNewNurbsRenderer
creates and returns a pointer to a new NURBS
object. This object must be referred to when calling NURBS rendering
and control functions. A return value of 0 means that there is not
enough memory to allocate the object.
Create a quadrics object.
gluNewQuadric
creates and returns a pointer to a new quadrics
object. This object must be referred to when calling quadrics rendering
and control functions. A return value of 0 means that there is not
enough memory to allocate the object.
Create a tessellation object.
gluNewTess
creates and returns a pointer to a new tessellation
object. This object must be referred to when calling tessellation
functions. A return value of 0 means that there is not enough memory to
allocate the object.
Mark the beginning of another contour.
Specifies the tessellation object (created with gluNewTess
).
Specifies the type of the contour being defined. Valid values are
GLU_EXTERIOR
, GLU_INTERIOR
, GLU_UNKNOWN
,
GLU_CCW
, and GLU_CW
.
gluNextContour
is used in describing polygons with multiple
contours. After the first contour has been described through a series
of gluTessVertex
calls, a gluNextContour
call indicates
that the previous contour is complete and that the next contour is about
to begin. Another series of gluTessVertex
calls is then used to
describe the new contour. This process can be repeated until all
contours have been described.
type defines what type of contour follows. The legal contour types are as follows:
GLU_EXTERIOR
An exterior contour defines an exterior boundary of the polygon.
GLU_INTERIOR
An interior contour defines an interior boundary of the polygon (such as a hole).
GLU_UNKNOWN
An unknown contour is analyzed by the library to determine if it is interior or exterior.
GLU_CCW
,GLU_CW
The first GLU_CCW
or GLU_CW
contour defined is considered
to be exterior. All other contours are considered to be exterior if
they are oriented in the same direction (clockwise or counterclockwise)
as the first contour, and interior if they are not.
If one contour is of type GLU_CCW
or GLU_CW
, then all
contours must be of the same type (if they are not, then all
GLU_CCW
and GLU_CW
contours will be changed to
GLU_UNKNOWN
).
Note that there is no real difference between the GLU_CCW
and
GLU_CW
contour types.
Before the first contour is described, gluNextContour
can be
called to define the type of the first contour. If
gluNextContour
is not called before the first contour, then the
first contour is marked GLU_EXTERIOR
.
This command is obsolete and is provided for backward compatibility
only. Calls to gluNextContour
are mapped to
gluTessEndContour
followed by gluTessBeginContour
.
Set a user data pointer.
Specifies the NURBS object (created with gluNewNurbsRenderer
).
Specifies a pointer to the user’s data.
gluNurbsCallbackDataEXT
is used to pass a pointer to the
application’s data to NURBS tessellator. A copy of this pointer will be
passed by the tessellator in the NURBS callback functions (set by
gluNurbsCallback
).
Set a user data pointer.
Specifies the NURBS object (created with gluNewNurbsRenderer
).
Specifies a pointer to the user’s data.
gluNurbsCallbackData
is used to pass a pointer to the
application’s data to NURBS tessellator. A copy of this pointer will be
passed by the tessellator in the NURBS callback functions (set by
gluNurbsCallback
).
Define a callback for a NURBS object.
Specifies the NURBS object (created with gluNewNurbsRenderer
).
Specifies the callback being defined. Valid values are
GLU_NURBS_BEGIN
, GLU_NURBS_VERTEX
,
GLU_NURBS_NORMAL
, GLU_NURBS_COLOR
,
GLU_NURBS_TEXTURE_COORD
, GLU_NURBS_END
,
GLU_NURBS_BEGIN_DATA
, GLU_NURBS_VERTEX_DATA
,
GLU_NURBS_NORMAL_DATA
, GLU_NURBS_COLOR_DATA
,
GLU_NURBS_TEXTURE_COORD_DATA
, GLU_NURBS_END_DATA
, and
GLU_NURBS_ERROR
.
Specifies the function that the callback calls.
gluNurbsCallback
is used to define a callback to be used by a
NURBS object. If the specified callback is already defined, then it is
replaced. If CallBackFunc is NULL, then this callback will not
get invoked and the related data, if any, will be lost.
Except the error callback, these callbacks are used by NURBS tessellator
(when GLU_NURBS_MODE
is set to be GLU_NURBS_TESSELLATOR
)
to return back the OpenGL polygon primitives resulting from the
tessellation. Note that there are two versions of each callback: one
with a user data pointer and one without. If both versions for a
particular callback are specified then the callback with the user data
pointer will be used. Note that “userData” is a copy of the pointer
that was specified at the last call to gluNurbsCallbackData
.
The error callback function is effective no matter which value that
GLU_NURBS_MODE
is set to. All other callback functions are
effective only when GLU_NURBS_MODE
is set to
GLU_NURBS_TESSELLATOR
.
The legal callbacks are as follows:
GLU_NURBS_BEGIN
The begin callback indicates the start of a primitive. The function
takes a single argument of type GLenum, which can be one of
GLU_LINES
, GLU_LINE_STRIP
, GLU_TRIANGLE_FAN
,
GLU_TRIANGLE_STRIP
, GLU_TRIANGLES
, or
GLU_QUAD_STRIP
. The default begin callback function is NULL. The
function prototype for this callback looks like:
GLU_NURBS_BEGIN_DATA
The same as the GLU_NURBS_BEGIN
callback except that it takes an
additional pointer argument. This pointer is a copy of the pointer that
was specified at the last call to gluNurbsCallbackData
. The
default callback function is NULL. The function prototype for this
callback function looks like:
GLU_NURBS_VERTEX
The vertex callback indicates a vertex of the primitive. The coordinates of the vertex are stored in the parameter “vertex”. All the generated vertices have dimension 3; that is, homogeneous coordinates have been transformed into affine coordinates. The default vertex callback function is NULL. The function prototype for this callback function looks like:
GLU_NURBS_VERTEX_DATA
This is the same as the GLU_NURBS_VERTEX
callback, except that it
takes an additional pointer argument. This pointer is a copy of the
pointer that was specified at the last call to
gluNurbsCallbackData
. The default callback function is NULL. The
function prototype for this callback function looks like:
GLU_NURBS_NORMAL
The normal callback is invoked as the vertex normal is generated. The
components of the normal are stored in the parameter “normal.” In the
case of a NURBS curve, the callback function is effective only when the
user provides a normal map (GLU_MAP1_NORMAL
). In the case of a
NURBS surface, if a normal map (GLU_MAP2_NORMAL
) is provided,
then the generated normal is computed from the normal map. If a normal
map is not provided, then a surface normal is computed in a manner
similar to that described for evaluators when GLU_AUTO_NORMAL
is
enabled. The default normal callback function is NULL. The function
prototype for this callback function looks like:
GLU_NURBS_NORMAL_DATA
The same as the GLU_NURBS_NORMAL
callback except that it takes an
additional pointer argument. This pointer is a copy of the pointer that
was specified at the last call to gluNurbsCallbackData
. The
default callback function is NULL. The function prototype for this
callback function looks like:
GLU_NURBS_COLOR
The color callback is invoked as the color of a vertex is generated. The
components of the color are stored in the parameter “color.” This
callback is effective only when the user provides a color map
(GLU_MAP1_COLOR_4
or GLU_MAP2_COLOR_4
). “color”
contains four components: R, G, B, A. The default color callback
function is NULL. The prototype for this callback function looks like:
GLU_NURBS_COLOR_DATA
The same as the GLU_NURBS_COLOR
callback except that it takes an
additional pointer argument. This pointer is a copy of the pointer that
was specified at the last call to gluNurbsCallbackData
. The
default callback function is NULL. The function prototype for this
callback function looks like:
GLU_NURBS_TEXTURE_COORD
The texture callback is invoked as the texture coordinates of a vertex
are generated. These coordinates are stored in the parameter
“texCoord.” The number of texture coordinates can be 1, 2, 3, or 4
depending on which type of texture map is specified
(GLU_MAP1_TEXTURE_COORD_1
, GLU_MAP1_TEXTURE_COORD_2
,
GLU_MAP1_TEXTURE_COORD_3
, GLU_MAP1_TEXTURE_COORD_4
,
GLU_MAP2_TEXTURE_COORD_1
, GLU_MAP2_TEXTURE_COORD_2
,
GLU_MAP2_TEXTURE_COORD_3
, GLU_MAP2_TEXTURE_COORD_4
). If
no texture map is specified, this callback function will not be called.
The default texture callback function is NULL. The function prototype
for this callback function looks like:
GLU_NURBS_TEXTURE_COORD_DATA
This is the same as the GLU_NURBS_TEXTURE_COORD
callback, except
that it takes an additional pointer argument. This pointer is a copy of
the pointer that was specified at the last call to
gluNurbsCallbackData
. The default callback function is NULL. The
function prototype for this callback function looks like:
GLU_NURBS_END
The end callback is invoked at the end of a primitive. The default end callback function is NULL. The function prototype for this callback function looks like:
GLU_NURBS_END_DATA
This is the same as the GLU_NURBS_END
callback, except that it
takes an additional pointer argument. This pointer is a copy of the
pointer that was specified at the last call to
gluNurbsCallbackData
. The default callback function is NULL. The
function prototype for this callback function looks like:
GLU_NURBS_ERROR
The error function is called when an error is encountered. Its single
argument is of type GLenum, and it indicates the specific error that
occurred. There are 37 errors unique to NURBS, named
GLU_NURBS_ERROR1
through GLU_NURBS_ERROR37
. Character
strings describing these errors can be retrieved with
gluErrorString
.
void begin( GLenum type );
void beginData(GLenum type, void *userData);
void vertex( GLfloat *vertex );
void vertexData( GLfloat *vertex, void *userData );
void normal( GLfloat *normal );
void normalData( GLfloat *normal, void *userData );
void color( GLfloat *color );
void colorData( GLfloat *color, void *userData );
void texCoord( GLfloat *texCoord );
void texCoordData( GLfloat *texCoord, void *userData );
void end( void );
void endData( void *userData );
Define the shape of a NURBS curve.
Specifies the NURBS object (created with gluNewNurbsRenderer
).
Specifies the number of knots in knots. knotCount equals the number of control points plus the order.
Specifies an array of knotCount nondecreasing knot values.
Specifies the offset (as a number of single-precision floating-point values) between successive curve control points.
Specifies a pointer to an array of control points. The coordinates must agree with type, specified below.
Specifies the order of the NURBS curve. order equals degree + 1, hence a cubic curve has an order of 4.
Specifies the type of the curve. If this curve is defined within a
gluBeginCurve
/gluEndCurve
pair, then the type can be any
of the valid one-dimensional evaluator types (such as
GLU_MAP1_VERTEX_3
or GLU_MAP1_COLOR_4
). Between a
gluBeginTrim
/gluEndTrim
pair, the only valid types are
GLU_MAP1_TRIM_2
and GLU_MAP1_TRIM_3
.
Use gluNurbsCurve
to describe a NURBS curve.
When gluNurbsCurve
appears between a
gluBeginCurve
/gluEndCurve
pair, it is used to describe a
curve to be rendered. Positional, texture, and color coordinates are
associated by presenting each as a separate gluNurbsCurve
between
a gluBeginCurve
/gluEndCurve
pair. No more than one call
to gluNurbsCurve
for each of color, position, and texture data
can be made within a single gluBeginCurve
/gluEndCurve
pair. Exactly one call must be made to describe the position of the
curve (a type of GLU_MAP1_VERTEX_3
or
GLU_MAP1_VERTEX_4
).
When gluNurbsCurve
appears between a
gluBeginTrim
/gluEndTrim
pair, it is used to describe a
trimming curve on a NURBS surface. If type is
GLU_MAP1_TRIM_2
, then it describes a curve in two-dimensional
(u and v) parameter space. If it is GLU_MAP1_TRIM_3
,
then it describes a curve in two-dimensional homogeneous (u,
v, and w) parameter space. See the gluBeginTrim
reference page for more discussion about trimming curves.
Set a NURBS property.
Specifies the NURBS object (created with gluNewNurbsRenderer
).
Specifies the property to be set. Valid values are
GLU_SAMPLING_TOLERANCE
, GLU_DISPLAY_MODE
,
GLU_CULLING
, GLU_AUTO_LOAD_MATRIX
,
GLU_PARAMETRIC_TOLERANCE
, GLU_SAMPLING_METHOD
,
GLU_U_STEP
, GLU_V_STEP
, or GLU_NURBS_MODE
.
Specifies the value of the indicated property. It may be a numeric
value or one of GLU_OUTLINE_POLYGON
, GLU_FILL
,
GLU_OUTLINE_PATCH
, GLU_TRUE
, GLU_FALSE
,
GLU_PATH_LENGTH
, GLU_PARAMETRIC_ERROR
,
GLU_DOMAIN_DISTANCE
, GLU_NURBS_RENDERER
, or
GLU_NURBS_TESSELLATOR
.
gluNurbsProperty
is used to control properties stored in a NURBS
object. These properties affect the way that a NURBS curve is rendered.
The accepted values for property are as follows:
GLU_NURBS_MODE
value should be set to be either GLU_NURBS_RENDERER
or
GLU_NURBS_TESSELLATOR
. When set to GLU_NURBS_RENDERER
,
NURBS objects are tessellated into OpenGL primitives and sent to the
pipeline for rendering. When set to GLU_NURBS_TESSELLATOR
, NURBS
objects are tessellated into OpenGL primitives but the vertices,
normals, colors, and/or textures are retrieved back through a callback
interface (see gluNurbsCallback
). This allows the user to cache
the tessellated results for further processing. The initial value is
GLU_NURBS_RENDERER
.
GLU_SAMPLING_METHOD
Specifies how a NURBS surface should be tessellated. value may be
one of GLU_PATH_LENGTH
, GLU_PARAMETRIC_ERROR
,
GLU_DOMAIN_DISTANCE
, GLU_OBJECT_PATH_LENGTH
, or
GLU_OBJECT_PARAMETRIC_ERROR
. When set to GLU_PATH_LENGTH
,
the surface is rendered so that the maximum length, in pixels, of the
edges of the tessellation polygons is no greater than what is specified
by GLU_SAMPLING_TOLERANCE
.
GLU_PARAMETRIC_ERROR
specifies that the surface is rendered in
such a way that the value specified by GLU_PARAMETRIC_TOLERANCE
describes the maximum distance, in pixels, between the tessellation
polygons and the surfaces they approximate.
GLU_DOMAIN_DISTANCE
allows users to specify, in parametric
coordinates, how many sample points per unit length are taken in
u, v direction.
GLU_OBJECT_PATH_LENGTH
is similar to GLU_PATH_LENGTH
except that it is view independent; that is, the surface is rendered so
that the maximum length, in object space, of edges of the tessellation
polygons is no greater than what is specified by
GLU_SAMPLING_TOLERANCE
.
GLU_OBJECT_PARAMETRIC_ERROR
is similar to
GLU_PARAMETRIC_ERROR
except that it is view independent; that is,
the surface is rendered in such a way that the value specified by
GLU_PARAMETRIC_TOLERANCE
describes the maximum distance, in
object space, between the tessellation polygons and the surfaces they
approximate.
The initial value of GLU_SAMPLING_METHOD
is
GLU_PATH_LENGTH
.
GLU_SAMPLING_TOLERANCE
Specifies the maximum length, in pixels or in object space length unit,
to use when the sampling method is set to GLU_PATH_LENGTH
or
GLU_OBJECT_PATH_LENGTH
. The NURBS code is conservative when
rendering a curve or surface, so the actual length can be somewhat
shorter. The initial value is 50.0 pixels.
GLU_PARAMETRIC_TOLERANCE
Specifies the maximum distance, in pixels or in object space length
unit, to use when the sampling method is GLU_PARAMETRIC_ERROR
or
GLU_OBJECT_PARAMETRIC_ERROR
. The initial value is 0.5.
GLU_U_STEP
Specifies the number of sample points per unit length taken along the
u axis in parametric coordinates. It is needed when
GLU_SAMPLING_METHOD
is set to GLU_DOMAIN_DISTANCE
. The
initial value is 100.
GLU_V_STEP
Specifies the number of sample points per unit length taken along the
v axis in parametric coordinate. It is needed when
GLU_SAMPLING_METHOD
is set to GLU_DOMAIN_DISTANCE
. The
initial value is 100.
GLU_DISPLAY_MODE
value can be set to GLU_OUTLINE_POLYGON
, GLU_FILL
,
or GLU_OUTLINE_PATCH
. When GLU_NURBS_MODE
is set to be
GLU_NURBS_RENDERER
, value defines how a NURBS surface
should be rendered. When value is set to GLU_FILL
, the
surface is rendered as a set of polygons. When value is set to
GLU_OUTLINE_POLYGON
, the NURBS library draws only the outlines of
the polygons created by tessellation. When value is set to
GLU_OUTLINE_PATCH
just the outlines of patches and trim curves
defined by the user are drawn.
When GLU_NURBS_MODE
is set to be GLU_NURBS_TESSELLATOR
,
value defines how a NURBS surface should be tessellated. When
GLU_DISPLAY_MODE
is set to GLU_FILL
or
GLU_OUTLINE_POLYGON
, the NURBS surface is tessellated into OpenGL
triangle primitives that can be retrieved back through callback
functions. If GLU_DISPLAY_MODE
is set to
GLU_OUTLINE_PATCH
, only the outlines of the patches and trim
curves are generated as a sequence of line strips that can be retrieved
back through callback functions.
The initial value is GLU_FILL
.
GLU_CULLING
value is a boolean value that, when set to GLU_TRUE
,
indicates that a NURBS curve should be discarded prior to tessellation
if its control points lie outside the current viewport. The initial
value is GLU_FALSE
.
GLU_AUTO_LOAD_MATRIX
value is a boolean value. When set to GLU_TRUE
, the NURBS
code downloads the projection matrix, the modelview matrix, and the
viewport from the GL server to compute sampling and culling matrices for
each NURBS curve that is rendered. Sampling and culling matrices are
required to determine the tessellation of a NURBS surface into line
segments or polygons and to cull a NURBS surface if it lies outside the
viewport.
If this mode is set to GLU_FALSE
, then the program needs to
provide a projection matrix, a modelview matrix, and a viewport for the
NURBS renderer to use to construct sampling and culling matrices. This
can be done with the gluLoadSamplingMatrices
function. This mode
is initially set to GLU_TRUE
. Changing it from GLU_TRUE
to GLU_FALSE
does not affect the sampling and culling matrices
until gluLoadSamplingMatrices
is called.
Define the shape of a NURBS surface.
Specifies the NURBS object (created with gluNewNurbsRenderer
).
Specifies the number of knots in the parametric u direction.
Specifies an array of sKnotCount nondecreasing knot values in the parametric u direction.
Specifies the number of knots in the parametric v direction.
Specifies an array of tKnotCount nondecreasing knot values in the parametric v direction.
Specifies the offset (as a number of single-precision floating-point values) between successive control points in the parametric u direction in control.
Specifies the offset (in single-precision floating-point values) between successive control points in the parametric v direction in control.
Specifies an array containing control points for the NURBS surface. The offsets between successive control points in the parametric u and v directions are given by sStride and tStride.
Specifies the order of the NURBS surface in the parametric u direction. The order is one more than the degree, hence a surface that is cubic in u has a u order of 4.
Specifies the order of the NURBS surface in the parametric v direction. The order is one more than the degree, hence a surface that is cubic in v has a v order of 4.
Specifies type of the surface. type can be any of the valid
two-dimensional evaluator types (such as GLU_MAP2_VERTEX_3
or
GLU_MAP2_COLOR_4
).
Use gluNurbsSurface
within a NURBS (Non-Uniform Rational
B-Spline) surface definition to describe the shape of a NURBS surface
(before any trimming). To mark the beginning of a NURBS surface
definition, use the gluBeginSurface
command. To mark the end of
a NURBS surface definition, use the gluEndSurface
command. Call
gluNurbsSurface
within a NURBS surface definition only.
Positional, texture, and color coordinates are associated with a surface
by presenting each as a separate gluNurbsSurface
between a
gluBeginSurface
/gluEndSurface
pair. No more than one call
to gluNurbsSurface
for each of color, position, and texture data
can be made within a single gluBeginSurface
/gluEndSurface
pair. Exactly one call must be made to describe the position of the
surface (a type of GLU_MAP2_VERTEX_3
or
GLU_MAP2_VERTEX_4
).
A NURBS surface can be trimmed by using the commands
gluNurbsCurve
and gluPwlCurve
between calls to
gluBeginTrim
and gluEndTrim
.
Note that a gluNurbsSurface
with sKnotCount knots in the
u direction and tKnotCount knots in the v direction
with orders sOrder and tOrder must have (sKnotCount -
sOrder) times (tKnotCount - tOrder) control
points.
Define a 2D orthographic projection matrix.
Specify the coordinates for the left and right vertical clipping planes.
Specify the coordinates for the bottom and top horizontal clipping planes.
gluOrtho2D
sets up a two-dimensional orthographic viewing region.
This is equivalent to calling glOrtho
with near=-1 and
far=1.
Draw an arc of a disk.
Specifies a quadrics object (created with gluNewQuadric
).
Specifies the inner radius of the partial disk (can be 0).
Specifies the outer radius of the partial disk.
Specifies the number of subdivisions around the z axis.
Specifies the number of concentric rings about the origin into which the partial disk is subdivided.
Specifies the starting angle, in degrees, of the disk portion.
Specifies the sweep angle, in degrees, of the disk portion.
gluPartialDisk
renders a partial disk on the z=0 plane.
A partial disk is similar to a full disk, except that only the subset of
the disk from start through start + sweep is included
(where 0 degrees is along the +\f2y\f axis, 90 degrees along the
+x axis, 180 degrees along the \-y axis, and 270 degrees
along the \-x axis).
The partial disk has a radius of outer and contains a concentric circular hole with a radius of inner. If inner is 0, then no hole is generated. The partial disk is subdivided around the z axis into slices (like pizza slices) and also about the z axis into rings (as specified by slices and loops, respectively).
With respect to orientation, the +z side of the partial disk is
considered to be outside (see gluQuadricOrientation
). This means
that if the orientation is set to GLU_OUTSIDE
, then any normals
generated point along the +z axis. Otherwise, they point along
the \-z axis.
If texturing is turned on (with gluQuadricTexture
), texture
coordinates are generated linearly such that where
r=outer, the value at (r, 0, 0) is (1.0, 0.5), at
(0, r, 0) it is (0.5, 1.0), at (\-r, 0, 0) it is (0.0, 0.5),
and at (0, \-r, 0) it is (0.5, 0.0).
Set up a perspective projection matrix.
Specifies the field of view angle, in degrees, in the y direction.
Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
Specifies the distance from the viewer to the near clipping plane (always positive).
Specifies the distance from the viewer to the far clipping plane (always positive).
gluPerspective
specifies a viewing frustum into the world
coordinate system. In general, the aspect ratio in
gluPerspective
should match the aspect ratio of the associated
viewport. For example, aspect=2.0 means the viewer’s angle of
view is twice as wide in x as it is in y. If the viewport
is twice as wide as it is tall, it displays the image without
distortion.
The matrix generated by gluPerspective
is multipled by the
current matrix, just as if glMultMatrix
were called with the
generated matrix. To load the perspective matrix onto the current
matrix stack instead, precede the call to gluPerspective
with a
call to glLoadIdentity
.
Given f defined as follows:
f=cotangentâ¡(fovy/2,) The generated matrix is
((f/aspect 0 0 0), (0 f 0 0), (0 0 zFar+zNear,/zNear-zFar, 2ÃzFarÃzNear,/zNear-zFar,), (0 0 -1 0),)
Define a picking region.
Specify the center of a picking region in window coordinates.
Specify the width and height, respectively, of the picking region in window coordinates.
Specifies the current viewport (as from a glGetIntegerv
call).
gluPickMatrix
creates a projection matrix that can be used to
restrict drawing to a small region of the viewport. This is typically
useful to determine what objects are being drawn near the cursor. Use
gluPickMatrix
to restrict drawing to a small region around the
cursor. Then, enter selection mode (with glRenderMode
) and
rerender the scene. All primitives that would have been drawn near the
cursor are identified and stored in the selection buffer.
The matrix created by gluPickMatrix
is multiplied by the current
matrix just as if glMultMatrix
is called with the generated
matrix. To effectively use the generated pick matrix for picking, first
call glLoadIdentity
to load an identity matrix onto the
perspective matrix stack. Then call gluPickMatrix
, and, finally,
call a command (such as gluPerspective
) to multiply the
perspective matrix by the pick matrix.
When using gluPickMatrix
to pick NURBS, be careful to turn off
the NURBS property GLU_AUTO_LOAD_MATRIX
. If
GLU_AUTO_LOAD_MATRIX
is not turned off, then any NURBS surface
rendered is subdivided differently with the pick matrix than the way it
was subdivided without the pick matrix.
Map object coordinates to window coordinates.
Specify the object coordinates.
Specifies the current modelview matrix (as from a glGetDoublev
call).
Specifies the current projection matrix (as from a glGetDoublev
call).
Specifies the current viewport (as from a glGetIntegerv
call).
Return the computed window coordinates.
gluProject
transforms the specified object coordinates into
window coordinates using model, proj, and view. The
result is stored in winX, winY, and winZ. A return
value of GLU_TRUE
indicates success, a return value of
GLU_FALSE
indicates failure.
To compute the coordinates, let
v=(objX,objYobjZ1.0) represented as a matrix
with 4 rows and 1 column. Then gluProject
computes v^â³
as follows:
v^â³=PÃMÃv
where P is the current projection matrix proj and M is the current modelview matrix model (both represented as 4Ã4 matrices in column-major order).
The window coordinates are then computed as follows:
winX=viewâ¡(0,)+viewâ¡(2,)Ã(v^â³â¡(0,)+1,)/2winY=viewâ¡(1,)+viewâ¡(3,)Ã(v^â³â¡(1,)+1,)/2 winZ=(v^â³â¡(2,)+1,)/2
Describe a piecewise linear NURBS trimming curve.
Specifies the NURBS object (created with gluNewNurbsRenderer
).
Specifies the number of points on the curve.
Specifies an array containing the curve points.
Specifies the offset (a number of single-precision floating-point values) between points on the curve.
Specifies the type of curve. Must be either GLU_MAP1_TRIM_2
or
GLU_MAP1_TRIM_3
.
gluPwlCurve
describes a piecewise linear trimming curve for a
NURBS surface. A piecewise linear curve consists of a list of
coordinates of points in the parameter space for the NURBS surface to be
trimmed. These points are connected with line segments to form a curve.
If the curve is an approximation to a curve that is not piecewise
linear, the points should be close enough in parameter space that the
resulting path appears curved at the resolution used in the application.
If type is GLU_MAP1_TRIM_2
, then it describes a curve in
two-dimensional (u and v) parameter space. If it is
GLU_MAP1_TRIM_3
, then it describes a curve in two-dimensional
homogeneous (u, v, and w) parameter space. See the
gluBeginTrim
reference page for more information about trimming
curves.
Define a callback for a quadrics object.
Specifies the quadrics object (created with gluNewQuadric
).
Specifies the callback being defined. The only valid value is
GLU_ERROR
.
Specifies the function to be called.
gluQuadricCallback
is used to define a new callback to be used by
a quadrics object. If the specified callback is already defined, then
it is replaced. If CallBackFunc is NULL, then any existing
callback is erased.
The one legal callback is GLU_ERROR
:
GLU_ERROR
The function is called when an error is encountered. Its single
argument is of type GLenum, and it indicates the specific error that
occurred. Character strings describing these errors can be retrieved
with the gluErrorString
call.
Specify the draw style desired for quadrics.
Specifies the quadrics object (created with gluNewQuadric
).
Specifies the desired draw style. Valid values are GLU_FILL
,
GLU_LINE
, GLU_SILHOUETTE
, and GLU_POINT
.
gluQuadricDrawStyle
specifies the draw style for quadrics
rendered with quad. The legal values are as follows:
GLU_FILL
Quadrics are rendered with polygon primitives. The polygons are drawn
in a counterclockwise fashion with respect to their normals (as defined
with gluQuadricOrientation
).
GLU_LINE
Quadrics are rendered as a set of lines.
GLU_SILHOUETTE
Quadrics are rendered as a set of lines, except that edges separating coplanar faces will not be drawn.
GLU_POINT
Quadrics are rendered as a set of points.
Specify what kind of normals are desired for quadrics.
Specifies the quadrics object (created with gluNewQuadric
).
Specifies the desired type of normals. Valid values are
GLU_NONE
, GLU_FLAT
, and GLU_SMOOTH
.
gluQuadricNormals
specifies what kind of normals are desired for
quadrics rendered with quad. The legal values are as follows:
GLU_NONE
No normals are generated.
GLU_FLAT
One normal is generated for every facet of a quadric.
GLU_SMOOTH
One normal is generated for every vertex of a quadric. This is the initial value.
Specify inside/outside orientation for quadrics.
Specifies the quadrics object (created with gluNewQuadric
).
Specifies the desired orientation. Valid values are GLU_OUTSIDE
and GLU_INSIDE
.
gluQuadricOrientation
specifies what kind of orientation is
desired for quadrics rendered with quad. The orientation
values are as follows:
GLU_OUTSIDE
Quadrics are drawn with normals pointing outward (the initial value).
GLU_INSIDE
Quadrics are drawn with normals pointing inward.
Note that the interpretation of outward and inward depends on the quadric being drawn.
Specify if texturing is desired for quadrics.
Specifies the quadrics object (created with gluNewQuadric
).
Specifies a flag indicating if texture coordinates should be generated.
gluQuadricTexture
specifies if texture coordinates should be
generated for quadrics rendered with quad. If the value of
texture is GLU_TRUE
, then texture coordinates are
generated, and if texture is GLU_FALSE
, they are not. The
initial value is GLU_FALSE
.
The manner in which texture coordinates are generated depends upon the specific quadric rendered.
Scale an image to an arbitrary size.
Specifies the format of the pixel data. The following symbolic values
are valid: GLU_COLOR_INDEX
, GLU_STENCIL_INDEX
,
GLU_DEPTH_COMPONENT
, GLU_RED
, GLU_GREEN
,
GLU_BLUE
, GLU_ALPHA
, GLU_RGB
, GLU_RGBA
,
GLU_BGR
, GLU_BGRA
, GLU_LUMINANCE
, and
GLU_LUMINANCE_ALPHA
.
Specify in pixels the width and height, respectively, of the source image.
Specifies the data type for dataIn. Must be one of
GLU_UNSIGNED_BYTE
, GLU_BYTE
, GLU_BITMAP
,
GLU_UNSIGNED_SHORT
, GLU_SHORT
, GLU_UNSIGNED_INT
,
GLU_INT
, GLU_FLOAT
, GLU_UNSIGNED_BYTE_3_3_2
,
GLU_UNSIGNED_BYTE_2_3_3_REV
, GLU_UNSIGNED_SHORT_5_6_5
,
GLU_UNSIGNED_SHORT_5_6_5_REV
, GLU_UNSIGNED_SHORT_4_4_4_4
,
GLU_UNSIGNED_SHORT_4_4_4_4_REV
,
GLU_UNSIGNED_SHORT_5_5_5_1
,
GLU_UNSIGNED_SHORT_1_5_5_5_REV
, GLU_UNSIGNED_INT_8_8_8_8
,
GLU_UNSIGNED_INT_8_8_8_8_REV
, GLU_UNSIGNED_INT_10_10_10_2
,
or GLU_UNSIGNED_INT_2_10_10_10_REV
.
Specifies a pointer to the source image.
Specify the width and height, respectively, in pixels of the destination image.
Specifies the data type for dataOut. Must be one of
GLU_UNSIGNED_BYTE
, GLU_BYTE
, GLU_BITMAP
,
GLU_UNSIGNED_SHORT
, GLU_SHORT
, GLU_UNSIGNED_INT
,
GLU_INT
, GLU_FLOAT
, GLU_UNSIGNED_BYTE_3_3_2
,
GLU_UNSIGNED_BYTE_2_3_3_REV
, GLU_UNSIGNED_SHORT_5_6_5
,
GLU_UNSIGNED_SHORT_5_6_5_REV
, GLU_UNSIGNED_SHORT_4_4_4_4
,
GLU_UNSIGNED_SHORT_4_4_4_4_REV
,
GLU_UNSIGNED_SHORT_5_5_5_1
,
GLU_UNSIGNED_SHORT_1_5_5_5_REV
, GLU_UNSIGNED_INT_8_8_8_8
,
GLU_UNSIGNED_INT_8_8_8_8_REV
, GLU_UNSIGNED_INT_10_10_10_2
,
or GLU_UNSIGNED_INT_2_10_10_10_REV
.
Specifies a pointer to the destination image.
gluScaleImage
scales a pixel image using the appropriate pixel
store modes to unpack data from the source image and pack data into the
destination image.
When shrinking an image, gluScaleImage
uses a box filter to
sample the source image and create pixels for the destination image.
When magnifying an image, the pixels from the source image are linearly
interpolated to create the destination image.
A return value of zero indicates success, otherwise a GLU error code is
returned (see gluErrorString
).
See the glReadPixels
reference page for a description of the
acceptable values for the format, typeIn, and typeOut
parameters.
GLU_INVALID_VALUE
is returned if wIn, hIn,
wOut, or hOut is negative.
GLU_INVALID_ENUM
is returned if format, typeIn, or
typeOut is not legal.
GLU_INVALID_OPERATION
is returned if typeIn or
typeOut is GLU_UNSIGNED_BYTE_3_3_2
or
GLU_UNSIGNED_BYTE_2_3_3_REV
and format is not
GLU_RGB
.
GLU_INVALID_OPERATION
is returned if typeIn or
typeOut is GLU_UNSIGNED_SHORT_5_6_5
or
GLU_UNSIGNED_SHORT_5_6_5_REV
and format is not
GLU_RGB
.
GLU_INVALID_OPERATION
is returned if typeIn or
typeOut is GLU_UNSIGNED_SHORT_4_4_4_4
or
GLU_UNSIGNED_SHORT_4_4_4_4_REV
and format is neither
GLU_RGBA
nor GLU_BGRA
.
GLU_INVALID_OPERATION
is returned if typeIn or
typeOut is GLU_UNSIGNED_SHORT_5_5_5_1
or
GLU_UNSIGNED_SHORT_1_5_5_5_REV
and format is neither
GLU_RGBA
nor GLU_BGRA
.
GLU_INVALID_OPERATION
is returned if typeIn or
typeOut is GLU_UNSIGNED_INT_8_8_8_8
or
GLU_UNSIGNED_INT_8_8_8_8_REV
and format is neither
GLU_RGBA
nor GLU_BGRA
.
GLU_INVALID_OPERATION
is returned if typeIn or
typeOut is GLU_UNSIGNED_INT_10_10_10_2
or
GLU_UNSIGNED_INT_2_10_10_10_REV
and format is neither
GLU_RGBA
nor GLU_BGRA
.
Draw a sphere.
Specifies the quadrics object (created with gluNewQuadric
).
Specifies the radius of the sphere.
Specifies the number of subdivisions around the z axis (similar to lines of longitude).
Specifies the number of subdivisions along the z axis (similar to lines of latitude).
gluSphere
draws a sphere of the given radius centered around the
origin. The sphere is subdivided around the z axis into slices
and along the z axis into stacks (similar to lines of longitude
and latitude).
If the orientation is set to GLU_OUTSIDE
(with
gluQuadricOrientation
), then any normals generated point away
from the center of the sphere. Otherwise, they point toward the center
of the sphere.
If texturing is turned on (with gluQuadricTexture
), then texture
coordinates are generated so that t ranges from 0.0 at
z=-radius to 1.0 at z=radius (t
increases linearly along longitudinal lines), and s ranges from
0.0 at the +y axis, to 0.25 at the +x axis, to 0.5 at the
\-y axis, to 0.75 at the \-x axis, and back to 1.0 at the
+y axis.
Delimit a contour description.
Specifies the tessellation object (created with gluNewTess
).
gluTessBeginContour
and gluTessEndContour
delimit the
definition of a polygon contour. Within each
gluTessBeginContour
/gluTessEndContour
pair, there can be
zero or more calls to gluTessVertex
. The vertices specify a
closed contour (the last vertex of each contour is automatically linked
to the first). See the gluTessVertex
reference page for more
details. gluTessBeginContour
can only be called between
gluTessBeginPolygon
and gluTessEndPolygon
.
Delimit a polygon description.
Specifies the tessellation object (created with gluNewTess
).
Specifies a pointer to user polygon data.
gluTessBeginPolygon
and gluTessEndPolygon
delimit the
definition of a convex, concave or self-intersecting polygon. Within
each gluTessBeginPolygon
/gluTessEndPolygon
pair, there
must be one or more calls to
gluTessBeginContour
/gluTessEndContour
. Within each
contour, there are zero or more calls to gluTessVertex
. The
vertices specify a closed contour (the last vertex of each contour is
automatically linked to the first). See the gluTessVertex
,
gluTessBeginContour
, and gluTessEndContour
reference pages
for more details.
data is a pointer to a user-defined data structure. If the
appropriate callback(s) are specified (see gluTessCallback
), then
this pointer is returned to the callback function(s). Thus, it is a
convenient way to store per-polygon information.
Once gluTessEndPolygon
is called, the polygon is tessellated, and
the resulting triangles are described through callbacks. See
gluTessCallback
for descriptions of the callback functions.
Define a callback for a tessellation object.
Specifies the tessellation object (created with gluNewTess
).
Specifies the callback being defined. The following values are valid:
GLU_TESS_BEGIN
, GLU_TESS_BEGIN_DATA
,
GLU_TESS_EDGE_FLAG
, GLU_TESS_EDGE_FLAG_DATA
,
GLU_TESS_VERTEX
, GLU_TESS_VERTEX_DATA
,
GLU_TESS_END
, GLU_TESS_END_DATA
, GLU_TESS_COMBINE
,
GLU_TESS_COMBINE_DATA
, GLU_TESS_ERROR
, and
GLU_TESS_ERROR_DATA
.
Specifies the function to be called.
gluTessCallback
is used to indicate a callback to be used by a
tessellation object. If the specified callback is already defined, then
it is replaced. If CallBackFunc is NULL, then the existing
callback becomes undefined.
These callbacks are used by the tessellation object to describe how a
polygon specified by the user is broken into triangles. Note that there
are two versions of each callback: one with user-specified polygon data
and one without. If both versions of a particular callback are
specified, then the callback with user-specified polygon data will be
used. Note that the polygon_data parameter used by some of the
functions is a copy of the pointer that was specified when
gluTessBeginPolygon
was called. The legal callbacks are as
follows:
GLU_TESS_BEGIN
The begin callback is invoked like glBegin
to indicate the start
of a (triangle) primitive. The function takes a single argument of type
GLenum. If the GLU_TESS_BOUNDARY_ONLY
property is set to
GLU_FALSE
, then the argument is set to either
GLU_TRIANGLE_FAN
, GLU_TRIANGLE_STRIP
, or
GLU_TRIANGLES
. If the GLU_TESS_BOUNDARY_ONLY
property is
set to GLU_TRUE
, then the argument will be set to
GLU_LINE_LOOP
. The function prototype for this callback is:
GLU_TESS_BEGIN_DATA
The same as the GLU_TESS_BEGIN
callback except that it takes an
additional pointer argument. This pointer is identical to the opaque
pointer provided when gluTessBeginPolygon
was called. The
function prototype for this callback is:
GLU_TESS_EDGE_FLAG
The edge flag callback is similar to glEdgeFlag
. The function
takes a single boolean flag that indicates which edges lie on the
polygon boundary. If the flag is GLU_TRUE
, then each vertex that
follows begins an edge that lies on the polygon boundary, that is, an
edge that separates an interior region from an exterior one. If the
flag is GLU_FALSE
, then each vertex that follows begins an edge
that lies in the polygon interior. The edge flag callback (if defined)
is invoked before the first vertex callback.
Since triangle fans and triangle strips do not support edge flags, the
begin callback is not called with GLU_TRIANGLE_FAN
or
GLU_TRIANGLE_STRIP
if a non-NULL edge flag callback is provided.
(If the callback is initialized to NULL, there is no impact on
performance). Instead, the fans and strips are converted to independent
triangles. The function prototype for this callback is:
GLU_TESS_EDGE_FLAG_DATA
The same as the GLU_TESS_EDGE_FLAG
callback except that it takes
an additional pointer argument. This pointer is identical to the opaque
pointer provided when gluTessBeginPolygon
was called. The
function prototype for this callback is:
GLU_TESS_VERTEX
The vertex callback is invoked between the begin and end callbacks. It
is similar to glVertex
, and it defines the vertices of the
triangles created by the tessellation process. The function takes a
pointer as its only argument. This pointer is identical to the opaque
pointer provided by the user when the vertex was described (see
gluTessVertex
). The function prototype for this callback is:
GLU_TESS_VERTEX_DATA
The same as the GLU_TESS_VERTEX
callback except that it takes an
additional pointer argument. This pointer is identical to the opaque
pointer provided when gluTessBeginPolygon
was called. The
function prototype for this callback is:
GLU_TESS_END
The end callback serves the same purpose as glEnd
. It indicates
the end of a primitive and it takes no arguments. The function
prototype for this callback is:
GLU_TESS_END_DATA
The same as the GLU_TESS_END
callback except that it takes an
additional pointer argument. This pointer is identical to the opaque
pointer provided when gluTessBeginPolygon
was called. The
function prototype for this callback is:
GLU_TESS_COMBINE
The combine callback is called to create a new vertex when the tessellation detects an intersection or wishes to merge features. The function takes four arguments: an array of three elements each of type GLdouble, an array of four pointers, an array of four elements each of type GLfloat, and a pointer to a pointer. The prototype is:
The vertex is defined as a linear combination of up to four existing vertices, stored in vertex_data. The coefficients of the linear combination are given by weight; these weights always add up to 1. All vertex pointers are valid even when some of the weights are 0. coords gives the location of the new vertex.
The user must allocate another vertex, interpolate parameters using
vertex_data and weight, and return the new vertex pointer in
outData. This handle is supplied during rendering callbacks. The
user is responsible for freeing the memory some time after
gluTessEndPolygon
is called.
For example, if the polygon lies in an arbitrary plane in 3-space, and a
color is associated with each vertex, the GLU_TESS_COMBINE
callback might look like this:
If the tessellation detects an intersection, then the
GLU_TESS_COMBINE
or GLU_TESS_COMBINE_DATA
callback (see
below) must be defined, and it must write a non-NULL pointer into
dataOut. Otherwise the GLU_TESS_NEED_COMBINE_CALLBACK
error occurs, and no output is generated.
GLU_TESS_COMBINE_DATA
The same as the GLU_TESS_COMBINE
callback except that it takes an
additional pointer argument. This pointer is identical to the opaque
pointer provided when gluTessBeginPolygon
was called. The
function prototype for this callback is:
GLU_TESS_ERROR
The error callback is called when an error is encountered. The one
argument is of type GLenum; it indicates the specific error that
occurred and will be set to one of
GLU_TESS_MISSING_BEGIN_POLYGON
,
GLU_TESS_MISSING_END_POLYGON
,
GLU_TESS_MISSING_BEGIN_CONTOUR
,
GLU_TESS_MISSING_END_CONTOUR
, GLU_TESS_COORD_TOO_LARGE
,
GLU_TESS_NEED_COMBINE_CALLBACK
, or GLU_OUT_OF_MEMORY
.
Character strings describing these errors can be retrieved with the
gluErrorString
call. The function prototype for this callback
is:
The GLU library will recover from the first four errors by inserting the
missing call(s). GLU_TESS_COORD_TOO_LARGE
indicates that some
vertex coordinate exceeded the predefined constant
GLU_TESS_MAX_COORD
in absolute value, and that the value has been
clamped. (Coordinate values must be small enough so that two can be
multiplied together without overflow.)
GLU_TESS_NEED_COMBINE_CALLBACK
indicates that the tessellation
detected an intersection between two edges in the input data, and the
GLU_TESS_COMBINE
or GLU_TESS_COMBINE_DATA
callback was not
provided. No output is generated. GLU_OUT_OF_MEMORY
indicates
that there is not enough memory so no output is generated.
GLU_TESS_ERROR_DATA
The same as the GLU_TESS_ERROR
callback except that it takes an
additional pointer argument. This pointer is identical to the opaque
pointer provided when gluTessBeginPolygon
was called. The
function prototype for this callback is:
void begin( GLenum type );
void beginData( GLenum type, void *polygon_data );
void edgeFlag( GLboolean flag );
void edgeFlagData( GLboolean flag, void *polygon_data );
void vertex( void *vertex_data );
void vertexData( void *vertex_data, void *polygon_data );
void end( void );
void endData( void *polygon_data );
void combine( GLdouble coords[3], void *vertex_data[4], GLfloat weight[4], void **outData );
void myCombine( GLdouble coords[3], VERTEX *d[4], GLfloat w[4], VERTEX **dataOut ) { VERTEX *new = new_vertex(); new->x = coords[0]; new->y = coords[1]; new->z = coords[2]; new->r = w[0]*d[0]->r + w[1]*d[1]->r + w[2]*d[2]->r + w[3]*d[3]->r; new->g = w[0]*d[0]->g + w[1]*d[1]->g + w[2]*d[2]->g + w[3]*d[3]->g; new->b = w[0]*d[0]->b + w[1]*d[1]->b + w[2]*d[2]->b + w[3]*d[3]->b; new->a = w[0]*d[0]->a + w[1]*d[1]->a + w[2]*d[2]->a + w[3]*d[3]->a; *dataOut = new; }
void combineData( GLdouble coords[3], void *vertex_data[4], GLfloat weight[4], void **outData, void *polygon_data );
void error( GLenum errno );
void errorData( GLenum errno, void *polygon_data );
Delimit a polygon description.
Specifies the tessellation object (created with gluNewTess
).
gluTessBeginPolygon
and gluTessEndPolygon
delimit the
definition of a convex, concave, or self-intersecting polygon. Within
each gluTessBeginPolygon
/gluTessEndPolygon
pair, there
must be one or more calls to
gluTessBeginContour
/gluTessEndContour
. Within each
contour, there are zero or more calls to gluTessVertex
. The
vertices specify a closed contour (the last vertex of each contour is
automatically linked to the first). See the gluTessVertex
,
gluTessBeginContour
, and gluTessEndContour
reference pages
for more details.
Once gluTessEndPolygon
is called, the polygon is tessellated, and
the resulting triangles are described through callbacks. See
gluTessCallback
for descriptions of the callback functions.
Specify a normal for a polygon.
Specifies the tessellation object (created with gluNewTess
).
Specifies the first component of the normal.
Specifies the second component of the normal.
Specifies the third component of the normal.
gluTessNormal
describes a normal for a polygon that the program
is defining. All input data will be projected onto a plane
perpendicular to one of the three coordinate axes before tessellation
and all output triangles will be oriented CCW with respect to the normal
(CW orientation can be obtained by reversing the sign of the supplied
normal). For example, if you know that all polygons lie in the x-y
plane, call gluTessNormal
(tess, 0.0, 0.0, 1.0) before rendering
any polygons.
If the supplied normal is (0.0, 0.0, 0.0) (the initial value), the normal is determined as follows. The direction of the normal, up to its sign, is found by fitting a plane to the vertices, without regard to how the vertices are connected. It is expected that the input data lies approximately in the plane; otherwise, projection perpendicular to one of the three coordinate axes may substantially change the geometry. The sign of the normal is chosen so that the sum of the signed areas of all input contours is nonnegative (where a CCW contour has positive area).
The supplied normal persists until it is changed by another call to
gluTessNormal
.
Set a tessellation object property.
Specifies the tessellation object (created with gluNewTess
).
Specifies the property to be set. Valid values are
GLU_TESS_WINDING_RULE
, GLU_TESS_BOUNDARY_ONLY
, and
GLU_TESS_TOLERANCE
.
Specifies the value of the indicated property.
gluTessProperty
is used to control properties stored in a
tessellation object. These properties affect the way that the polygons
are interpreted and rendered. The legal values for which are as
follows:
GLU_TESS_WINDING_RULE
Determines which parts of the polygon are on the “interior”.
data may be set to one of GLU_TESS_WINDING_ODD
,
GLU_TESS_WINDING_NONZERO
, GLU_TESS_WINDING_POSITIVE
,
GLU_TESS_WINDING_NEGATIVE
, or
GLU_TESS_WINDING_ABS_GEQ_TWO
.
To understand how the winding rule works, consider that the input contours partition the plane into regions. The winding rule determines which of these regions are inside the polygon.
For a single contour C, the winding number of a point x is simply the signed number of revolutions we make around x as we travel once around C (where CCW is positive). When there are several contours, the individual winding numbers are summed. This procedure associates a signed integer value with each point x in the plane. Note that the winding number is the same for all points in a single region.
The winding rule classifies a region as “inside” if its winding number belongs to the chosen category (odd, nonzero, positive, negative, or absolute value of at least two). The previous GLU tessellator (prior to GLU 1.2) used the “odd” rule. The “nonzero” rule is another common way to define the interior. The other three rules are useful for polygon CSG operations.
GLU_TESS_BOUNDARY_ONLY
Is a boolean value (“value” should be set to GL_TRUE or GL_FALSE).
When set to GL_TRUE, a set of closed contours separating the polygon
interior and exterior are returned instead of a tessellation. Exterior
contours are oriented CCW with respect to the normal; interior contours
are oriented CW. The GLU_TESS_BEGIN
and
GLU_TESS_BEGIN_DATA
callbacks use the type GL_LINE_LOOP for each
contour.
GLU_TESS_TOLERANCE
Specifies a tolerance for merging features to reduce the size of the output. For example, two vertices that are very close to each other might be replaced by a single vertex. The tolerance is multiplied by the largest coordinate magnitude of any input vertex; this specifies the maximum distance that any feature can move as the result of a single merge operation. If a single feature takes part in several merge operations, the total distance moved could be larger.
Feature merging is completely optional; the tolerance is only a hint. The implementation is free to merge in some cases and not in others, or to never merge features at all. The initial tolerance is 0.
The current implementation merges vertices only if they are exactly coincident, regardless of the current tolerance. A vertex is spliced into an edge only if the implementation is unable to distinguish which side of the edge the vertex lies on. Two edges are merged only when both endpoints are identical.
Specify a vertex on a polygon.
Specifies the tessellation object (created with gluNewTess
).
Specifies the location of the vertex.
Specifies an opaque pointer passed back to the program with the vertex
callback (as specified by gluTessCallback
).
gluTessVertex
describes a vertex on a polygon that the program
defines. Successive gluTessVertex
calls describe a closed
contour. For example, to describe a quadrilateral, gluTessVertex
should be called four times. gluTessVertex
can only be called
between gluTessBeginContour
and gluTessEndContour
.
data normally points to a structure containing the vertex
location, as well as other per-vertex attributes such as color and
normal. This pointer is passed back to the user through the
GLU_TESS_VERTEX
or GLU_TESS_VERTEX_DATA
callback after
tessellation (see the gluTessCallback
reference page).
Map window and clip coordinates to object coordinates.
Specify the window coordinates to be mapped.
Specify the clip w coordinate to be mapped.
Specifies the modelview matrix (as from a glGetDoublev
call).
Specifies the projection matrix (as from a glGetDoublev
call).
Specifies the viewport (as from a glGetIntegerv
call).
Specifies the near and far planes (as from a glGetDoublev
call).
Returns the computed object coordinates.
gluUnProject4
maps the specified window coordinatesi: winX,
winY, and winZ and its clip w coordinate clipW into
object coordinates (objX,objYobjZobjW) using
model, proj, and view. clipW can be other than
1 as for vertices in glFeedbackBuffer
when data type
GLU_4D_COLOR_TEXTURE
is returned. This also handles the case
where the nearVal and farVal planes are different from the
default, 0 and 1, respectively. A return value of GLU_TRUE
indicates success; a return value of GLU_FALSE
indicates failure.
To compute the coordinates
(objX,objYobjZobjW), gluUnProject4
multiplies the normalized device coordinates by the inverse of
model * proj as follows:
((objX), (objY), (objZ), (objW),)=INVâ¡(Pâ¢M,)â¢((2â¡(winX-viewâ¡[0,],),/viewâ¡[2,],-1), (2â¡(winY-viewâ¡[1,],),/viewâ¡[3,],-1), (2â¡(winZ-nearVal,),/(farVal-nearVal,),-1), (clipW),)
INV denotes matrix inversion.
gluUnProject4
is equivalent to gluUnProject
when
clipW is 1, nearVal is 0, and farVal is 1.
Map window coordinates to object coordinates.
Specify the window coordinates to be mapped.
Specifies the modelview matrix (as from a glGetDoublev
call).
Specifies the projection matrix (as from a glGetDoublev
call).
Specifies the viewport (as from a glGetIntegerv
call).
Returns the computed object coordinates.
gluUnProject
maps the specified window coordinates into object
coordinates using model, proj, and view. The result
is stored in objX, objY, and objZ. A return value of
GLU_TRUE
indicates success; a return value of GLU_FALSE
indicates failure.
To compute the coordinates (objX,objYobjZ),
gluUnProject
multiplies the normalized device coordinates by the
inverse of model * proj as follows:
((objX), (objY), (objZ), (W),)=INVâ¡(Pâ¢M,)â¢((2â¡(winX-viewâ¡[0,],),/viewâ¡[2,],-1), (2â¡(winY-viewâ¡[1,],),/viewâ¡[3,],-1), (2â¡(winZ,)-1), (1),)INV denotes matrix inversion. W is an unused variable, included for consistent matrix notation.