glClearIndex specifies the index used by glClear to clear the color index
buffers. c is not clamped. Rather, c is converted to a fixed-point value
with unspecified precision to the right of the binary point. The integer
part of this value is then masked with 2m−1, where m is the number of bits
in a color index stored in the frame buffer.
glClearColor specifies the red, green, blue, and alpha values used by
glClear to clear the color buffers. Values specified by glClearColor are
clamped to the range [0, 1].
Example
-
Parameters
Param
Mode
Type
Default
Description
red_val
in
pen.glclampf
required
-
green_val
in
pen.glclampf
required
-
blue_val
in
pen.glclampf
required
-
alpha_val
in
pen.glclampf
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glclear( mask_val )
glClear sets the bitplane area of the window to values previously selected
by glClearColor, glClearIndex, glClearDepth, glClearStencil, and
glClearAccum. Multiple color buffers can be cleared simultaneously by
selecting more than one buffer at a time using glDrawBuffer.
The pixel ownership test, the scissor test, dithering, and the buffer
writemasks affect the operation of glClear. The scissor box bounds the
cleared region. Alpha function, blend function, logical operation, sten-
ciling, texture mapping, and depth-buffering are ignored by glClear.
glClear takes a single argument that is the bitwise OR of several values
indicating which buffer is to be cleared.
Example
-
Parameters
Param
Mode
Type
Default
Description
mask_val
in
pen.glbitfield
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glindexmask( mask_val )
glIndexMask controls the writing of individual bits in the color index buf-
fers. The least significant n bits of mask, where n is the number of bits
in a color index buffer, specify a mask. Where a 1 (one) appears in the
mask, it's possible to write to the corresponding bit in the color index
buffer (or buffers). Where a 0 (zero) appears, the corresponding bit is
write-protected.
This mask is used only in color index mode, and it affects only the buffers
currently selected for writing (see glDrawBuffer). Initially, all bits are
enabled for writing.
glColorMask specifies whether the individual color components in the frame
buffer can or cannot be written. If red is GL_FALSE, for example, no
change is made to the red component of any pixel in any of the color buf-
fers, regardless of the drawing operation attempted.
Changes to individual bits of components cannot be controlled. Rather,
changes are either enabled or disabled for entire color components.
Example
-
Parameters
Param
Mode
Type
Default
Description
red_val
in
pen.glboolean
required
-
green_val
in
pen.glboolean
required
-
blue_val
in
pen.glboolean
required
-
alpha_val
in
pen.glboolean
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glalphafunc( func_val, ref_val )
The alpha test discards fragments depending on the outcome of a comparison
between an incoming fragment's alpha value and a constant reference value.
glAlphaFunc specifies the reference value and the comparison function. The
comparison is performed only if alpha testing is enabled. By default, it is
not enabled. (See glEnable and glDisable of GL_ALPHA_TEST.)
func and ref specify the conditions under which the pixel is drawn. The
incoming alpha value is compared to ref using the function specified by
func. If the value passes the comparison, the incoming fragment is drawn
if it also passes subsequent stencil and depth buffer tests. If the value
fails the comparison, no change is made to the frame buffer at that pixel
location. The comparison functions are as follows:
GL_NEVER Never passes.
GL_LESS Passes if the incoming alpha value is less than the reference value.
GL_EQUAL Passes if the incoming alpha value is equal to the reference value.
GL_LEQUAL Passes if the incoming alpha value is less than or equal to the reference value.
GL_GREATER Passes if the incoming alpha value is greater than the reference value.
GL_NOTEQUAL Passes if the incoming alpha value is not equal to the reference value.
GL_GEQUAL Passes if the incoming alpha value is greater than or equal to the reference value.
GL_ALWAYS Always passes (initial value).
glAlphaFunc operates on all pixel write operations, including those result-
ing from the scan conversion of points, lines, polygons, and bitmaps, and
from pixel draw and copy operations. glAlphaFunc does not affect screen
clear operations.
Example
-
Parameters
Param
Mode
Type
Default
Description
func_val
in
pen.glalphacompare
required
-
ref_val
in
pen.glclampf
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glblendfunc( sfactor_val, dfactor_val )
In RGBA mode, pixels can be drawn using a function that blends the incoming
(source) RGBA values with the RGBA values that are already in the frame
buffer (the destination values). Blending is initially disabled. Use
glEnable and glDisable with argument GL_BLEND to enable and disable blend-
ing.
glBlendFunc defines the operation of blending when it is enabled. sfactor
specifies which of nine methods is used to scale the source color compo-
nents. dfactor specifies which of eight methods is used to scale the des-
tination color components. The eleven possible methods are described in
the following table. Each method defines four scale factors, one each for
red, green, blue, and alpha.
Example
-
Parameters
Param
Mode
Type
Default
Description
sfactor_val
in
pen.glblending
required
-
dfactor_val
in
pen.glblending
required
-
Exceptions
-
See Also
-
Compare With
-
pen.gllogicop( opcode_val )
glLogicOp specifies a logical operation that, when enabled, is applied
between the incoming color index or RGBA color and the color index or RGBA
color at the corresponding location in the frame buffer. To enable or dis-
able the logical operation, call glEnable and glDisable using the symbolic
constant GL_COLOR_LOGIC_OP for RGBA mode or GL_INDEX_LOGIC_OP for color
index mode. The initial value is disabled for both operations.
Example
-
Parameters
Param
Mode
Type
Default
Description
opcode_val
in
pen.gllogicops
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glcullface( mode_val )
glCullFace specifies whether front- or back-facing facets are culled (as
specified by mode) when facet culling is enabled. Facet culling is ini-
tially disabled. To enable and disable facet culling, call the glEnable
and glDisable commands with the argument GL_CULL_FACE. Facets include tri-
angles, quadrilaterals, polygons, and rectangles.
glFrontFace specifies which of the clockwise and counterclockwise facets
are front-facing and back-facing. See glFrontFace.
Example
-
Parameters
Param
Mode
Type
Default
Description
mode_val
in
pen.glbuffers
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glfrontface( mode_val )
In a scene composed entirely of opaque closed surfaces, back-facing poly-
gons are never visible. Eliminating these invisible polygons has the obvi-
ous benefit of speeding up the rendering of the image. To enable and dis-
able elimination of back-facing polygons, call glEnable and glDisable with
argument GL_CULL_FACE.
The projection of a polygon to window coordinates is said to have clockwise
winding if an imaginary object following the path from its first vertex,
its second vertex, and so on, to its last vertex, and finally back to its
first vertex, moves in a clockwise direction about the interior of the
polygon. The polygon's winding is said to be counterclockwise if the imag-
inary object following the same path moves in a counterclockwise direction
about the interior of the polygon. glFrontFace specifies whether polygons
with clockwise winding in window coordinates, or counterclockwise winding
in window coordinates, are taken to be front-facing. Passing GL_CCW to
mode selects counterclockwise polygons as front-facing; GL_CW selects
clockwise polygons as front-facing. By default, counterclockwise polygons
are taken to be front-facing.
Example
-
Parameters
Param
Mode
Type
Default
Description
mode_val
in
pen.glpolygons
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glpointsize( size_val )
glPointSize specifies the rasterized diameter of both aliased and
antialiased points. Using a point size other than 1 has different effects,
depending on whether point antialiasing is enabled. To enable and disable
point antialiasing, call glEnable and glDisable with argument
GL_POINT_SMOOTH. Point antialiasing is initially disabled.
If point antialiasing is disabled, the actual size is determined by round-
ing the supplied size to the nearest integer. (If the rounding results in
the value 0, it is as if the point size were 1.) If the rounded size is
odd, then the center point (x, y) of the pixel fragment that represents the
point is computed as
( ⌊xw⌋+.5, ⌊yw⌋+.5)
where w subscripts indicate window coordinates. All pixels that lie within
the square grid of the rounded size centered at (x, y) make up the frag-
ment. If the size is even, the center point is
( ⌊xw+.5⌋, ⌊yw+.5⌋)
and the rasterized fragment's centers are the half-integer window coordi-
nates within the square of the rounded size centered at (x, y). All pixel
fragments produced in rasterizing a nonantialiased point are assigned the
same associated data, that of the vertex corresponding to the point.
If antialiasing is enabled, then point rasterization produces a fragment
for each pixel square that intersects the region lying within the circle
having diameter equal to the current point size and centered at the point's
(xw, yw). The coverage value for each fragment is the window coordinate
area of the intersection of the circular region with the corresponding
pixel square. This value is saved and used in the final rasterization
step. The data associated with each fragment is the data associated with
the point being rasterized.
Not all sizes are supported when point antialiasing is enabled. If an
unsupported size is requested, the nearest supported size is used. Only
size 1 is guaranteed to be supported; others depend on the implementation.
To query the range of supported sizes and the size difference between sup-
ported sizes within the range, call glGet with arguments
GL_SMOOTH_POINT_SIZE_RANGE and GL_SMOOTH_POINT_SIZE_GRANULARITY. For
aliased points, query the supported ranges and granularity with glGet with
arguments GL_ALIASED_POINT_SIZE_RANGE and
GL_ALIASED_POINT_SIZE_GRANULARITY.
Example
-
Parameters
Param
Mode
Type
Default
Description
size_val
in
pen.glfloat
required
-
Exceptions
-
See Also
-
Compare With
-
pen.gllinewidth( width_val )
glLineWidth specifies the rasterized width of both aliased and antialiased
lines. Using a line width other than 1 has different effects, depending on
whether line antialiasing is enabled. To enable and disable line
antialiasing, call glEnable and glDisable with argument GL_LINE_SMOOTH.
Line antialiasing is initially disabled.
If line antialiasing is disabled, the actual width is determined by round-
ing the supplied width to the nearest integer. (If the rounding results in
the value 0, it is as if the line width were 1.) If |Δx|≥|Δy|, i pixels
are filled in each column that is rasterized, where i is the rounded value
of width. Otherwise, i pixels are filled in each row that is rasterized.
If antialiasing is enabled, line rasterization produces a fragment for each
pixel square that intersects the region lying within the rectangle having
width equal to the current line width, length equal to the actual length of
the line, and centered on the mathematical line segment. The coverage
value for each fragment is the window coordinate area of the intersection
of the rectangular region with the corresponding pixel square. This value
is saved and used in the final rasterization step.
Not all widths can be supported when line antialiasing is enabled. If an
unsupported width is requested, the nearest supported width is used. Only
width 1 is guaranteed to be supported; others depend on the implementation.
Likewise, there is a range for aliased line widths as well. To query the
range of supported widths and the size difference between supported widths
within the range, call glGet with arguments GL_ALIASED_LINE_WIDTH_RANGE,
GL_SMOOTH_LINE_WIDTH_RANGE, GL_SMOOTH_LINE_WIDTH_GRANULARITY.
Example
-
Parameters
Param
Mode
Type
Default
Description
width_val
in
pen.glfloat
required
-
Exceptions
-
See Also
-
Compare With
-
pen.gllinestipple( factor_val, pattern_val )
Line stippling masks out certain fragments produced by rasterization; those
fragments will not be drawn. The masking is achieved by using three param-
eters: the 16-bit line stipple pattern pattern, the repeat count factor,
and an integer stipple counter $s$.
Counter $s$ is reset to 0 whenever glBegin is called, and before each line
segment of a glBegin(GL_LINES)/glEnd sequence is generated. It is incre-
mented after each fragment of a unit width aliased line segment is gener-
ated, or after each $i$ fragments of an $i$ width line segment are gener-
ated. The $i$ fragments associated with count $s$ are masked out if
pattern bit $(s ~/~ "factor") ~roman mod~ 16$
is 0, otherwise these fragments are sent to the frame buffer. Bit zero of
pattern is the least significant bit.
Antialiased lines are treated as a sequence of $1 times width$ rectangles
for purposes of stippling. Whether rectangle $s$ is rasterized or not
depends on the fragment rule described for aliased lines, counting rectan-
gles rather than groups of fragments.
To enable and disable line stippling, call glEnable and glDisable with
argument GL_LINE_STIPPLE. When enabled, the line stipple pattern is
applied as described above. When disabled, it is as if the pattern were
all 1's. Initially, line stippling is disabled.
Example
-
Parameters
Param
Mode
Type
Default
Description
factor_val
in
pen.glint
required
-
pattern_val
in
pen.glushort
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glpolygonmode( face_val, mode_val )
glPolygonMode controls the interpretation of polygons for rasterization.
face describes which polygons mode applies to: front-facing polygons (-
GL_FRONT), back-facing polygons (GL_BACK), or both (GL_FRONT_AND_BACK).
The polygon mode affects only the final rasterization of polygons. In par-
ticular, a polygon's vertices are lit and the polygon is clipped and possi-
bly culled before these modes are applied.
Three modes are defined and can be specified in mode:
GL_POINT Polygon vertices that are marked as the start of a boundary
edge are drawn as points. Point attributes such as
GL_POINT_SIZE and GL_POINT_SMOOTH control the rasterization
of the points. Polygon rasterization attributes other than
GL_POLYGON_MODE have no effect.
GL_LINE Boundary edges of the polygon are drawn as line segments.
They are treated as connected line segments for line stip-
pling; the line stipple counter and pattern are not reset
between segments (see glLineStipple). Line attributes such
as GL_LINE_WIDTH and GL_LINE_SMOOTH control the rasterization
of the lines. Polygon rasterization attributes other than
GL_POLYGON_MODE have no effect.
GL_FILL The interior of the polygon is filled. Polygon attributes
such as GL_POLYGON_STIPPLE and GL_POLYGON_SMOOTH control the
rasterization of the polygon.
Example
-
Parameters
Param
Mode
Type
Default
Description
face_val
in
pen.glbuffers
required
-
mode_val
in
pen.glpolygons
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glpolygonoffset( factor_val, units_val )
When GL_POLYGON_OFFSET_FILL, GL_POLYGON_OFFSET_LINE, or
GL_POLYGON_OFFSET_POINT is enabled, each fragment's depth value will be
offset after it is interpolated from the depth values of the appropriate
vertices. The value of the offset is factor*DZ+r*units, where DZ is a mea-
surement of the change in depth relative to the screen area of the polygon,
and r is the smallest value that is guaranteed to produce a resolvable off-
set for a given implementation. The offset is added before the depth test
is performed and before the value is written into the depth buffer.
glPolygonOffset is useful for rendering hidden-line images, for applying
decals to surfaces, and for rendering solids with highlighted edges.
Example
-
Parameters
Param
Mode
Type
Default
Description
factor_val
in
pen.glfloat
required
-
units_val
in
pen.glfloat
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glpolygonstipple( mask_val )
Polygon stippling, like line stippling (see glLineStipple), masks out cer-
tain fragments produced by rasterization, creating a pattern. Stippling is
independent of polygon antialiasing.
mask is a pointer to a 32×32 stipple pattern that is stored in memory just
like the pixel data supplied to a glDrawPixels call with height and width
both equal to 32, a pixel of GL_COLOR_INDEX, and data type of GL_BITMAP.
That is, the stipple pattern is represented as a 32×32 array of 1-bit color
indices packed in unsigned bytes. glPixelStore parameters like
GL_UNPACK_SWAP_BYTES and GL_UNPACK_LSB_FIRST affect the assembling of the
bits into a stipple pattern. Pixel transfer operations (shift, offset,
pixel map) are not applied to the stipple image, however.
To enable and disable polygon stippling, call glEnable and glDisable with
argument GL_POLYGON_STIPPLE. Polygon stippling is initially disabled. If
it's enabled, a rasterized polygon fragment with window coordinates xw and
yw is sent to the next stage of the GL if and only if the (xwmod32)th bit
in the (ywmod32)th row of the stipple pattern is 1 (one). When polygon
stippling is disabled, it is as if the stipple pattern consists of all 1's.
Example
-
Parameters
Param
Mode
Type
Default
Description
mask_val
in
pen.glubyte
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glgetpolygonstipple( mask_val )
glGetPolygonStipple returns to mask a 32×32 polygon stipple pattern. The
pattern is packed into memory as if glReadPixels with both height and width
of 32, type of GL_BITMAP, and format of GL_COLOR_INDEX were called, and the
stipple pattern were stored in an internal 32×32 color index buffer.
Unlike glReadPixels, however, pixel transfer operations (shift, offset,
pixel map) are not applied to the returned stipple image.
Example
-
Parameters
Param
Mode
Type
Default
Description
mask_val
in
pen.glubyte
required
-
Exceptions
-
See Also
-
Compare With
-
pen.gledgeflag( flag_val )
Each vertex of a polygon, separate triangle, or separate quadrilateral
specified between a glBegin/glEnd pair is marked as the start of either a
boundary or nonboundary edge. If the current edge flag is true when the
vertex is specified, the vertex is marked as the start of a boundary edge.
Otherwise, the vertex is marked as the start of a nonboundary edge.
glEdgeFlag sets the edge flag bit to GL_TRUE if flag is GL_TRUE, and to
GL_FALSE otherwise.
The vertices of connected triangles and connected quadrilaterals are always
marked as boundary, regardless of the value of the edge flag.
Boundary and nonboundary edge flags on vertices are significant only if
GL_POLYGON_MODE is set to GL_POINT or GL_LINE. See glPolygonMode.
Example
-
Parameters
Param
Mode
Type
Default
Description
flag_val
in
pen.glboolean
required
-
Exceptions
-
See Also
-
Compare With
-
pen.gledgeflagv( flag_val )
Each vertex of a polygon, separate triangle, or separate quadrilateral
specified between a glBegin/glEnd pair is marked as the start of either a
boundary or nonboundary edge. If the current edge flag is true when the
vertex is specified, the vertex is marked as the start of a boundary edge.
Otherwise, the vertex is marked as the start of a nonboundary edge.
glEdgeFlag sets the edge flag bit to GL_TRUE if flag is GL_TRUE, and to
GL_FALSE otherwise.
The vertices of connected triangles and connected quadrilaterals are always
marked as boundary, regardless of the value of the edge flag.
Boundary and nonboundary edge flags on vertices are significant only if
GL_POLYGON_MODE is set to GL_POINT or GL_LINE. See glPolygonMode.
glScissor defines a rectangle, called the scissor box, in window coordi-
nates. The first two arguments, x and y, specify the lower left corner of
the box. width and height specify the width and height of the box.
To enable and disable the scissor test, call glEnable and glDisable with
argument GL_SCISSOR_TEST. The test is initially disabled. While the test
is enabled, only pixels that lie within the scissor box can be modified by
drawing commands. Window coordinates have integer values at the shared
corners of frame buffer pixels. glScissor(0,0,1,1) allows modification of
only the lower left pixel in the window, and glScissor(0,0,0,0) doesn't
allow modification of any pixels in the window.
When the scissor test is disabled, it is as though the scissor box includes
the entire window.
Example
-
Parameters
Param
Mode
Type
Default
Description
x_val
in
pen.glint
required
-
y_val
in
pen.glint
required
-
width_val
in
pen.glsizei
required
-
height_val
in
pen.glsizei
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glclipplane( plane_val, equation_val )
Geometry is always clipped against the boundaries of a six-plane frustum in
x, y, and z. glClipPlane allows the specification of additional planes,
not necessarily perpendicular to the x, y, or z axis, against which all
geometry is clipped. To determine the maximum number of additional clip-
ping planes, call glGetIntegerv with argument GL_MAX_CLIP_PLANES. All
implementations support at least six such clipping planes. Because the
resulting clipping region is the intersection of the defined half-spaces,
it is always convex.
glClipPlane specifies a half-space using a four-component plane equation.
When glClipPlane is called, equation is transformed by the inverse of the
modelview matrix and stored in the resulting eye coordinates. Subsequent
changes to the modelview matrix have no effect on the stored plane-equation
components. If the dot product of the eye coordinates of a vertex with the
stored plane equation components is positive or zero, the vertex is in with
respect to that clipping plane. Otherwise, it is out.
To enable and disable clipping planes, call glEnable and glDisable with the
argument GL_CLIP_PLANEi, where i is the plane number.
All clipping planes are initially defined as (0, 0, 0, 0) in eye coordi-
nates and are disabled.
Example
-
Parameters
Param
Mode
Type
Default
Description
plane_val
in
pen.glusercplane
required
-
equation_val
in
pen.gldouble
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glgetclipplane( plane_val, equation_val )
glGetClipPlane returns in equation the four coefficients of the plane equa-
tion for plane.
Example
-
Parameters
Param
Mode
Type
Default
Description
plane_val
in
pen.glusercplane
required
-
equation_val
in
pen.gldouble
required
-
Exceptions
-
See Also
-
Compare With
-
pen.gldrawbuffer( mode_val )
When colors are written to the frame buffer, they are written into the
color buffers specified by glDrawBuffer. The specifications are as fol-
lows:
GL_NONE No color buffers are written.
GL_FRONT_LEFT Only the front left color buffer is written.
GL_FRONT_RIGHT Only the front right color buffer is written.
GL_BACK_LEFT Only the back left color buffer is written.
GL_BACK_RIGHT Only the back right color buffer is written.
GL_FRONT Only the front left and front right color buffers
are written. If there is no front right color
buffer, only the front left color buffer is writ-
ten.
GL_BACK Only the back left and back right color buffers
are written. If there is no back right color buf-
fer, only the back left color buffer is written.
GL_LEFT Only the front left and back left color buffers
are written. If there is no back left color buf-
fer, only the front left color buffer is written.
GL_RIGHT Only the front right and back right color buffers
are written. If there is no back right color buf-
fer, only the front right color buffer is written.
GL_FRONT_AND_BACK All the front and back color buffers (front left,
front right, back left, back right) are written.
If there are no back color buffers, only the front
left and front right color buffers are written.
If there are no right color buffers, only the
front left and back left color buffers are writ-
ten. If there are no right or back color buffers,
only the front left color buffer is written.
GL_AUXi Only auxiliary color buffer i is written.
If more than one color buffer is selected for drawing, then blending or
logical operations are computed and applied independently for each color
buffer and can produce different results in each buffer.
Example
-
Parameters
Param
Mode
Type
Default
Description
mode_val
in
pen.glbuffers
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glreadbuffer( mode_val )
glReadBuffer specifies a color buffer as the source for subsequent
glReadPixels, glCopyTexImage1D, glCopyTexImage2D, glCopyTexSubImage1D,
glCopyTexSubImage2D, glCopyTexSubImage3D, and glCopyPixels commands. mode
accepts one of twelve or more predefined values. (GL_AUX0 through GL_AUX3
are always defined.) In a fully configured system, GL_FRONT, GL_LEFT, and
GL_FRONT_LEFT all name the front left buffer, GL_FRONT_RIGHT and GL_RIGHT
name the front right buffer, and GL_BACK_LEFT and GL_BACK name the back
left buffer.
Nonstereo double-buffered configurations have only a front left and a back
left buffer. Single-buffered configurations have a front left and a front
right buffer if stereo, and only a front left buffer if nonstereo. It is
an error to specify a nonexistent buffer to glReadBuffer.
mode is initially GL_FRONT in single-buffered configurations, and GL_BACK
in double-buffered configurations.
Example
-
Parameters
Param
Mode
Type
Default
Description
mode_val
in
pen.glbuffers
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glenable( cap_val )
glEnable and glDisable enable and disable various capabilities. Use
glIsEnabled or glGet to determine the current setting of any capability.
The initial value for each capability with the exception of GL_DITHER is
GL_FALSE. The initial value for GL_DITHER is GL_TRUE.
Example
-
Parameters
Param
Mode
Type
Default
Description
cap_val
in
pen.glenum
required
-
Exceptions
-
See Also
-
Compare With
-
pen.gldisable( cap_val )
glEnable and glDisable enable and disable various capabilities. Use
glIsEnabled or glGet to determine the current setting of any capability.
The initial value for each capability with the exception of GL_DITHER is
GL_FALSE. The initial value for GL_DITHER is GL_TRUE.
Example
-
Parameters
Param
Mode
Type
Default
Description
cap_val
in
pen.glenum
required
-
Exceptions
-
See Also
-
Compare With
-
r := pen.glisenabled( cap_val )
glIsEnabled returns GL_TRUE if cap is an enabled capability and returns
GL_FALSE otherwise. Initially all capabilities except GL_DITHER are dis-
abled; GL_DITHER is initially enabled.
Example
-
Parameters
Param
Mode
Type
Default
Description
r
result
-
required
-
cap_val
in
pen.glenum
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glenableclientstate( cap_val )
glEnableClientState and glDisableClientState enable or disable individual
client-side capabilities. By default, all client-side capabilities are dis-
abled. Both glEnableClientState and glDisableClientState take a single
argument
Example
-
Parameters
Param
Mode
Type
Default
Description
cap_val
in
pen.glenum
required
-
Exceptions
-
See Also
-
Compare With
-
pen.gldisableclientstate( cap_val )
glEnableClientState and glDisableClientState enable or disable individual
client-side capabilities. By default, all client-side capabilities are dis-
abled. Both glEnableClientState and glDisableClientState take a single
argument
Example
-
Parameters
Param
Mode
Type
Default
Description
cap_val
in
pen.glenum
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glgetbooleanv( pname_val, params_val )
These four commands return values for simple state variables in GL. pname
is a symbolic constant indicating the state variable to be returned, and
params is a pointer to an array of the indicated type in which to place the
returned data.
Type conversion is performed if params has a different type than the state
variable value being requested. If glGetBooleanv is called, a floating-
point (or integer) value is converted to GL_FALSE if and only if it is 0.0
(or 0). Otherwise, it is converted to GL_TRUE. If glGetIntegerv is
called, boolean values are returned as GL_TRUE or GL_FALSE, and most float-
ing-point values are rounded to the nearest integer value. Floating-point
colors and normals, however, are returned with a linear mapping that maps
1.0 to the most positive representable integer value, and -1.0 to the most
negative representable integer value. If glGetFloatv or glGetDoublev is
called, boolean values are returned as GL_TRUE or GL_FALSE, and integer
values are converted to floating-point values.
Example
-
Parameters
Param
Mode
Type
Default
Description
pname_val
in
pen.glenum
required
-
params_val
in
pen.glboolean
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glgetdoublev( pname_val, params_val )
These four commands return values for simple state variables in GL. pname
is a symbolic constant indicating the state variable to be returned, and
params is a pointer to an array of the indicated type in which to place the
returned data.
Type conversion is performed if params has a different type than the state
variable value being requested. If glGetBooleanv is called, a floating-
point (or integer) value is converted to GL_FALSE if and only if it is 0.0
(or 0). Otherwise, it is converted to GL_TRUE. If glGetIntegerv is
called, boolean values are returned as GL_TRUE or GL_FALSE, and most float-
ing-point values are rounded to the nearest integer value. Floating-point
colors and normals, however, are returned with a linear mapping that maps
1.0 to the most positive representable integer value, and -1.0 to the most
negative representable integer value. If glGetFloatv or glGetDoublev is
called, boolean values are returned as GL_TRUE or GL_FALSE, and integer
values are converted to floating-point values.
Example
-
Parameters
Param
Mode
Type
Default
Description
pname_val
in
pen.glenum
required
-
params_val
in
pen.gldouble
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glgetfloatv( pname_val, params_val )
These four commands return values for simple state variables in GL. pname
is a symbolic constant indicating the state variable to be returned, and
params is a pointer to an array of the indicated type in which to place the
returned data.
Type conversion is performed if params has a different type than the state
variable value being requested. If glGetBooleanv is called, a floating-
point (or integer) value is converted to GL_FALSE if and only if it is 0.0
(or 0). Otherwise, it is converted to GL_TRUE. If glGetIntegerv is
called, boolean values are returned as GL_TRUE or GL_FALSE, and most float-
ing-point values are rounded to the nearest integer value. Floating-point
colors and normals, however, are returned with a linear mapping that maps
1.0 to the most positive representable integer value, and -1.0 to the most
negative representable integer value. If glGetFloatv or glGetDoublev is
called, boolean values are returned as GL_TRUE or GL_FALSE, and integer
values are converted to floating-point values.
Example
-
Parameters
Param
Mode
Type
Default
Description
pname_val
in
pen.glenum
required
-
params_val
in
pen.glfloat
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glgetintegerv( pname_val, params_val )
These four commands return values for simple state variables in GL. pname
is a symbolic constant indicating the state variable to be returned, and
params is a pointer to an array of the indicated type in which to place the
returned data.
Type conversion is performed if params has a different type than the state
variable value being requested. If glGetBooleanv is called, a floating-
point (or integer) value is converted to GL_FALSE if and only if it is 0.0
(or 0). Otherwise, it is converted to GL_TRUE. If glGetIntegerv is
called, boolean values are returned as GL_TRUE or GL_FALSE, and most float-
ing-point values are rounded to the nearest integer value. Floating-point
colors and normals, however, are returned with a linear mapping that maps
1.0 to the most positive representable integer value, and -1.0 to the most
negative representable integer value. If glGetFloatv or glGetDoublev is
called, boolean values are returned as GL_TRUE or GL_FALSE, and integer
values are converted to floating-point values.
Example
-
Parameters
Param
Mode
Type
Default
Description
pname_val
in
pen.glenum
required
-
params_val
in
pen.glint
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glpushattrib( mask_val )
glPushAttrib takes one argument, a mask that indicates which groups of
state variables to save on the attribute stack. Symbolic constants are
used to set bits in the mask. mask is typically constructed by ORing sev-
eral of these constants together. The special mask GL_ALL_ATTRIB_BITS can
be used to save all stackable states.
It is an error to push attributes onto a full stack, or to pop attributes
off an empty stack. In either case, the error flag is set and no other
change is made to GL state.
Initially, the attribute stack is empty.
Example
-
Parameters
Param
Mode
Type
Default
Description
mask_val
in
pen.glbitfield
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glpopattrib( )
glPopAttrib restores the values of the state variables saved with the last
glPushAttrib command. Those not saved are left unchanged.
It is an error to push attributes onto a full stack, or to pop attributes
off an empty stack. In either case, the error flag is set and no other
change is made to GL state.
Initially, the attribute stack is empty.
Example
-
Parameters
Param
Mode
Type
Default
Description
Exceptions
-
See Also
-
Compare With
-
pen.glpushclientattrib( mask_val )
glPushClientAttrib takes one argument, a mask that indicates which groups
of client-state variables to save on the client attribute stack. Symbolic
constants are used to set bits in the mask. 1.1 is typically constructed
by OR'ing several of these constants together. The special mask
GL_CLIENT_ALL_ATTRIB_BITS can be used to save all stackable client state.
It is an error to push attributes onto a full client attribute stack, or to
pop attributes off an empty stack. In either case, the error flag is set,
and no other change is made to GL state.
Initially, the client attribute stack is empty.
Example
-
Parameters
Param
Mode
Type
Default
Description
mask_val
in
pen.glbitfield
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glpopclientattrib( )
glPopClientAttrib restores the values of the client-state variables saved
with the last glPushClientAttrib. Those not saved are left unchanged.
It is an error to push attributes onto a full client attribute stack, or to
pop attributes off an empty stack. In either case, the error flag is set,
and no other change is made to GL state.
Initially, the client attribute stack is empty.
Example
-
Parameters
Param
Mode
Type
Default
Description
Exceptions
-
See Also
-
Compare With
-
r := pen.glrendermode( mode_val )
glRenderMode sets the rasterization mode. It takes one argument, mode,
which can assume one of three predefined values:
GL_RENDER Render mode. Primitives are rasterized, producing pixel
fragments, which are written into the frame buffer. This
is the normal mode and also the default mode.
GL_SELECT Selection mode. No pixel fragments are produced, and no
change to the frame buffer contents is made. Instead, a
record of the names of primitives that would have been
drawn if the render mode had been GL_RENDER is returned in
a select buffer, which must be created (see glSelectBuffer)
before selection mode is entered.
GL_FEEDBACK Feedback mode. No pixel fragments are produced, and no
change to the frame buffer contents is made. Instead, the
coordinates and attributes of vertices that would have been
drawn if the render mode had been GL_RENDER is returned in
a feedback buffer, which must be created (see
glFeedbackBuffer) before feedback mode is entered.
The return value of glRenderMode is determined by the render mode at the
time glRenderMode is called, rather than by mode. The values returned for
the three render modes are as follows:
GL_RENDER 0.
GL_SELECT The number of hit records transferred to the select buffer.
GL_FEEDBACK The number of values (not vertices) transferred to the
feedback buffer.
See the glSelectBuffer and glFeedbackBuffer reference pages for more
details concerning selection and feedback operation.
Example
-
Parameters
Param
Mode
Type
Default
Description
r
result
-
required
-
mode_val
in
pen.glrendermodes
required
-
Exceptions
-
See Also
-
Compare With
-
r := pen.glgeterror( )
glGetError returns the value of the error flag. Each detectable error is
assigned a numeric code and symbolic name. When an error occurs, the error
flag is set to the appropriate error code value. No other errors are
recorded until glGetError is called, the error code is returned, and the
flag is reset to GL_NO_ERROR. If a call to glGetError returns GL_NO_ERROR,
there has been no detectable error since the last call to glGetError, or
since the GL was initialized.
To allow for distributed implementations, there may be several error flags.
If any single error flag has recorded an error, the value of that flag is
returned and that flag is reset to GL_NO_ERROR when glGetError is called.
If more than one flag has recorded an error, glGetError returns and clears
an arbitrary error flag value. Thus, glGetError should always be called in
a loop, until it returns GL_NO_ERROR, if all error flags are to be reset.
Initially, all error flags are set to GL_NO_ERROR.
Example
-
Parameters
Param
Mode
Type
Default
Description
r
result
-
required
-
Exceptions
-
See Also
-
Compare With
-
r := pen.glgetstring( name_val )
glGetString returns a pointer to a static string describing some aspect of
the current GL connection. name can be one of the following:
GL_VENDOR Returns the company responsible for this GL implementa-
tion. This name does not change from release to
release.
GL_RENDERER Returns the name of the renderer. This name is typi-
cally specific to a particular configuration of a hard-
ware platform. It does not change from release to
release.
GL_VERSION Returns a version or release number.
GL_EXTENSIONS Returns a space-separated list of supported extensions
to GL.
Because the GL does not include queries for the performance characteristics
of an implementation, some applications are written to recognize known
platforms and modify their GL usage based on known performance characteris-
tics of these platforms. Strings GL_VENDOR and GL_RENDERER together
uniquely specify a platform. They do not change from release to release and
should be used by platform-recognition algorithms.
Some applications want to make use of features that are not part of the
standard GL. These features may be implemented as extensions to the stan-
dard GL. The GL_EXTENSIONS string is a space-separated list of supported
GL extensions. (Extension names never contain a space character.)
The GL_VERSION string begins with a version number. The version number
uses one of these forms:
Vendor-specific information may follow the version number. Its depends on
the implementation, but a space always separates the version number and the
vendor-specific information.
All strings are null-terminated.
Example
-
Parameters
Param
Mode
Type
Default
Description
r
result
-
required
-
name_val
in
pen.glenum
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glfinish( )
glFinish does not return until the effects of all previously called GL com-
mands are complete. Such effects include all changes to GL state, all
changes to connection state, and all changes to the frame buffer contents.
Example
-
Parameters
Param
Mode
Type
Default
Description
Exceptions
-
See Also
-
Compare With
-
pen.glflush( )
Different GL implementations buffer commands in several different loca-
tions, including network buffers and the graphics accelerator itself.
glFlush empties all of these buffers, causing all issued commands to be
executed as quickly as they are accepted by the actual rendering engine.
Though this execution may not be completed in any particular time period,
it does complete in finite time.
Because any GL program might be executed over a network, or on an accelera-
tor that buffers commands, all programs should call glFlush whenever they
count on having all of their previously issued commands completed. For
example, call glFlush before waiting for user input that depends on the
generated image.
Example
-
Parameters
Param
Mode
Type
Default
Description
Exceptions
-
See Also
-
Compare With
-
pen.glhint( target_val, mode_val )
Certain aspects of GL behavior, when there is room for interpretation, can
be controlled with hints. A hint is specified with two arguments. target
is a symbolic constant indicating the behavior to be controlled, and mode
is another symbolic constant indicating the desired behavior. The initial
value for each target is GL_DONT_CARE. mode can be one of the following:
GL_FASTEST The most efficient option should be chosen.
GL_NICEST The most correct, or highest quality, option should be
chosen.
GL_DONT_CARE No preference.
Though the implementation aspects that can be hinted are well defined, the
interpretation of the hints depends on the implementation. The hint
aspects that can be specified with target, along with suggested semantics,
are as follows:
GL_FOG_HINT Indicates the accuracy of fog calculation. If per-
pixel fog calculation is not efficiently supported by
the GL implementation, hinting GL_DONT_CARE or
GL_FASTEST can result in per-vertex calculation of fog
effects.
GL_LINE_SMOOTH_HINT Indicates the sampling quality of antialiased lines.
If a larger filter function is applied, hinting
GL_NICEST can result in more pixel fragments being gen-
erated during rasterization,
GL_PERSPECTIVE_CORRECTION_HINT
Indicates the quality of color and texture coordinate
interpolation. If perspective-corrected parameter
interpolation is not efficiently supported by the GL
implementation, hinting GL_DONT_CARE or GL_FASTEST can
result in simple linear interpolation of colors and/or
texture coordinates.
GL_POINT_SMOOTH_HINT
Indicates the sampling quality of antialiased points.
If a larger filter function is applied, hinting
GL_NICEST can result in more pixel fragments being gen-
erated during rasterization,
GL_POLYGON_SMOOTH_HINT
Indicates the sampling quality of antialiased polygons.
Hinting GL_NICEST can result in more pixel fragments
being generated during rasterization, if a larger fil-
ter function is applied.
Example
-
Parameters
Param
Mode
Type
Default
Description
target_val
in
pen.glhints
required
-
mode_val
in
pen.glhintmodes
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glcleardepth( depth_val )
glClearDepth specifies the depth value used by glClear to clear the depth
buffer. Values specified by glClearDepth are clamped to the range [0, 1].
Example
-
Parameters
Param
Mode
Type
Default
Description
depth_val
in
pen.glclampd
required
-
Exceptions
-
See Also
-
Compare With
-
pen.gldepthfunc( func_val )
glDepthFunc specifies the function used to compare each incoming pixel
depth value with the depth value present in the depth buffer. The compari-
son is performed only if depth testing is enabled. (See glEnable and
glDisable of GL_DEPTH_TEST.)
func specifies the conditions under which the pixel will be drawn. The
comparison functions are as follows:
GL_NEVER Never passes.
GL_LESS Passes if the incoming depth value is less than the stored
depth value.
GL_EQUAL Passes if the incoming depth value is equal to the stored
depth value.
GL_LEQUAL Passes if the incoming depth value is less than or equal to
the stored depth value.
GL_GREATER Passes if the incoming depth value is greater than the
stored depth value.
GL_NOTEQUAL Passes if the incoming depth value is not equal to the
stored depth value.
GL_GEQUAL Passes if the incoming depth value is greater than or equal
to the stored depth value.
GL_ALWAYS Always passes.
The initial value of func is GL_LESS. Initially, depth testing is dis-
abled. Even if the depth buffer exists and the depth mask is non-zero, the
depth buffer is not updated if the depth test is disabled.
Example
-
Parameters
Param
Mode
Type
Default
Description
func_val
in
pen.glalphacompare
required
-
Exceptions
-
See Also
-
Compare With
-
pen.gldepthmask( flag_val )
glDepthMask specifies whether the depth buffer is enabled for writing. If
flag is GL_FALSE, depth buffer writing is disabled. Otherwise, it is
enabled. Initially, depth buffer writing is enabled.
Example
-
Parameters
Param
Mode
Type
Default
Description
flag_val
in
pen.glboolean
required
-
Exceptions
-
See Also
-
Compare With
-
pen.gldepthrange( near_val_val, far_val_val )
After clipping and division by w, depth coordinates range from -1 to 1,
corresponding to the near and far clipping planes. glDepthRange specifies
a linear mapping of the normalized depth coordinates in this range to win-
dow depth coordinates. Regardless of the actual depth buffer implementa-
tion, window coordinate depth values are treated as though they range from
0 through 1 (like color components). Thus, the values accepted by
glDepthRange are both clamped to this range before they are accepted.
The setting of (0,1) maps the near plane to 0 and the far plane to 1. With
this mapping, the depth buffer range is fully utilized.
glClearAccum specifies the red, green, blue, and alpha values used by
glClear to clear the accumulation buffer.
Values specified by glClearAccum are clamped to the range [-1, 1].
Example
-
Parameters
Param
Mode
Type
Default
Description
red_val
in
pen.glfloat
required
-
green_val
in
pen.glfloat
required
-
blue_val
in
pen.glfloat
required
-
alpha_val
in
pen.glfloat
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glaccum( op_val, value_val )
The accumulation buffer is an extended-range color buffer. Images are not
rendered into it. Rather, images rendered into one of the color buffers
are added to the contents of the accumulation buffer after rendering.
Effects such as antialiasing (of points, lines, and polygons), motion blur,
and depth of field can be created by accumulating images generated with
different transformation matrices.
Each pixel in the accumulation buffer consists of red, green, blue, and
alpha values. The number of bits per component in the accumulation buffer
depends on the implementation. You can examine this number by calling
glGetIntegerv four times, with arguments GL_ACCUM_RED_BITS,
GL_ACCUM_GREEN_BITS, GL_ACCUM_BLUE_BITS, and GL_ACCUM_ALPHA_BITS. Regard-
less of the number of bits per component, the range of values stored by
each component is [-1, 1]. The accumulation buffer pixels are mapped one-
to-one with frame buffer pixels.
glAccum operates on the accumulation buffer. The first argument, op, is a
symbolic constant that selects an accumulation buffer operation. The sec-
ond argument, value, is a floating-point value to be used in that opera-
tion. Five operations are specified: GL_ACCUM, GL_LOAD, GL_ADD, GL_MULT,
and GL_RETURN.
All accumulation buffer operations are limited to the area of the current
scissor box and applied identically to the red, green, blue, and alpha com-
ponents of each pixel. If a glAccum operation results in a value outside
the range [-1, 1], the contents of an accumulation buffer pixel component
are undefined.
The operations are as follows:
GL_ACCUM Obtains R, G, B, and A values from the buffer currently
selected for reading (see glReadBuffer). Each component
value is divided by 2n−1, where n is the number of bits allo-
cated to each color component in the currently selected buf-
fer. The result is a floating-point value in the range
[0, 1], which is multiplied by value and added to the corre-
sponding pixel component in the accumulation buffer, thereby
updating the accumulation buffer.
GL_LOAD Similar to GL_ACCUM, except that the current value in the
accumulation buffer is not used in the calculation of the new
value. That is, the R, G, B, and A values from the currently
selected buffer are divided by 2n−1, multiplied by value, and
then stored in the corresponding accumulation buffer cell,
overwriting the current value.
GL_ADD Adds value to each R, G, B, and A in the accumulation buffer.
GL_MULT Multiplies each R, G, B, and A in the accumulation buffer by
value and returns the scaled component to its corresponding
accumulation buffer location.
GL_RETURN Transfers accumulation buffer values to the color buffer or
buffers currently selected for writing. Each R, G, B, and A
component is multiplied by value, then multiplied by 2n−1,
clamped to the range [0,2n−1], and stored in the correspond-
ing display buffer cell. The only fragment operations that
are applied to this transfer are pixel ownership, scissor,
dithering, and color writemasks.
To clear the accumulation buffer, call glClearAccum with R, G, B, and A
values to set it to, then call glClear with the accumulation buffer
enabled.
Example
-
Parameters
Param
Mode
Type
Default
Description
op_val
in
pen.glenum
required
-
value_val
in
pen.glfloat
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glmatrixmode( mode_val )
glMatrixMode sets the current matrix mode. mode can assume one of four
values:
GL_MODELVIEW Applies subsequent matrix operations to the mod-
elview matrix stack.
GL_PROJECTION Applies subsequent matrix operations to the pro-
jection matrix stack.
GL_TEXTURE Applies subsequent matrix operations to the tex-
ture matrix stack.
GL_COLOR Applies subsequent matrix operations to the color
matrix stack.
To find out which matrix stack is currently the target of all matrix opera-
tions, call glGet with argument GL_MATRIX_MODE. The initial value is
GL_MODELVIEW.
glOrtho describes a transformation that produces a parallel projection.
Typically, the matrix mode is GL_PROJECTION, and (left, bottom, -near_val) and
(right, top, -near_val) specify the points on the near clipping plane that are
mapped to the lower left and upper right corners of the window, respectively,
assuming that the eye is located at (0, 0, 0). -far_val specifies the location of
the far clipping plane. Both near_val and far_val can be either positive or nega-
tive.
Use glPushMatrix and glPopMatrix to save and restore the current matrix stack.
glFrustum describes a perspective matrix that produces a perspective pro-
jection.
Typically, the matrix mode is GL_PROJECTION, and (left, bottom, -near_val)
and (right, top, -near_val) specify the points on the near clipping plane
that are mapped to the lower left and upper right corners of the window,
assuming that the eye is located at (0, 0, 0). -far_val specifies the
location of the far clipping plane. Both near_val and far_val must be pos-
itive.
Use glPushMatrix and glPopMatrix to save and restore the current matrix
stack.
glViewport specifies the affine transformation of x and y from normalized
device coordinates to window coordinates. Let (xnd, ynd) be normalized
device coordinates. Then the window coordinates (xw, yw) are computed as
follows:
xw=(xnd+1)⎝wi_th⎠+x
yw=(ynd+1)⎝hei_ht⎠+y
Viewport width and height are silently clamped to a range that depends on the
implementation. To query this range, call glGet with argument
GL_MAX_VIEWPORT_DIMS.
Example
-
Parameters
Param
Mode
Type
Default
Description
x_val
in
pen.glint
required
-
y_val
in
pen.glint
required
-
width_val
in
pen.glsizei
required
-
height_val
in
pen.glsizei
required
-
Exceptions
-
See Also
-
Compare With
-
pen.glpushmatrix( )
There is a stack of matrices for each of the matrix modes. In GL_MODELVIEW
mode, the stack depth is at least 32. In the other modes, GL_COLOR,
const(PROJECTION), and GL_TEXTURE, the depth is at least 2. The current
matrix in any mode is the matrix on the top of the stack for that mode.
glPushMatrix pushes the current matrix stack down by one, duplicating the
current matrix. That is, after a glPushMatrix call, the matrix on top of
the stack is identical to the one below it.
glPopMatrix pops the current matrix stack, replacing the current matrix
with the one below it on the stack.
Initially, each of the stacks contains one matrix, an identity matrix.
It is an error to push a full matrix stack, or to pop a matrix stack that
contains only a single matrix. In either case, the error flag is set and
no other change is made to GL state.
Example
-
Parameters
Param
Mode
Type
Default
Description
Exceptions
-
See Also
-
Compare With
-
pen.glpopmatrix( )
There is a stack of matrices for each of the matrix modes. In GL_MODELVIEW
mode, the stack depth is at least 32. In the other modes, GL_COLOR,
const(PROJECTION), and GL_TEXTURE, the depth is at least 2. The current
matrix in any mode is the matrix on the top of the stack for that mode.
glPushMatrix pushes the current matrix stack down by one, duplicating the
current matrix. That is, after a glPushMatrix call, the matrix on top of
the stack is identical to the one below it.
glPopMatrix pops the current matrix stack, replacing the current matrix
with the one below it on the stack.
Initially, each of the stacks contains one matrix, an identity matrix.
It is an error to push a full matrix stack, or to pop a matrix stack that
contains only a single matrix. In either case, the error flag is set and
no other change is made to GL state.
Example
-
Parameters
Param
Mode
Type
Default
Description
Exceptions
-
See Also
-
Compare With
-
pen.glloadidentity( )
glLoadIdentity replaces the current matrix with the identity matrix.