没有合适的资源?快使用搜索试试~ 我知道了~
首页OpenGL 1.4官方参考手册:绘制高质量图形的关键
OpenGL 1.4官方参考手册:绘制高质量图形的关键
5星 · 超过95%的资源 需积分: 10 5 下载量 111 浏览量
更新于2024-07-26
收藏 395KB PDF 举报
OpenGL.Reference.Manual 是官方指定的 OpenGL 版本 1.4 的参考文档,由 OpenGL 架构审查委员会 (ARB) 授权。该手册详尽地阐述了 OpenGL,一个强大的软件接口,用于创建高质量的计算机生成图像和互动图形应用程序,支持2D和3D几何对象、位图以及颜色图像的渲染。它由 Silicon Graphics, Inc. 发布,该公司同时也是 OpenGL 和 Graphics Library 的商标持有者。
X Window System 也是 MIT 驰名商标。该文档的作者和出版商在编写过程中已经尽力确保准确性,但并不保证信息或程序的无误,并且不对因使用手册中的信息或程序而产生的偶然或间接损害承担责任。版权方面,所有权利归 Silicon Graphics, Inc. 所有,未经出版商事先书面许可,禁止任何形式的复制、存储、检索或通过电子、机械、影印、录音或其他方式传播。
OpenGL 是一种跨平台的图形API,它允许程序员以标准化的方式控制图形硬件,实现图形性能的高效利用。用户可以通过调用 OpenGL 函数来绘制几何形状、纹理、光照效果,甚至创建复杂的场景动画。手册详细介绍了核心特性如顶点数组对象(VAO)、着色器语言(GLSL)、纹理过滤、投影变换、混合模式等,以及可选特性如多采样抗锯齿(MSAA)和硬件加速的几何变换。
对于学习者来说,这份参考手册是学习 OpenGL 编程的基础,无论是初学者还是高级开发者,都可以从中找到所需的信息,从基础的绘图指令到高级的技术实践。同时,它也包含了示例代码和案例研究,帮助读者理解和掌握 OpenGL 的工作原理与实际应用。
在开发过程中,遵循 OpenGL 的编程指南和最佳实践至关重要,因为这将直接影响到图形渲染的效率和视觉效果。对于软件开发者而言,这份文档是不可或缺的参考资料,能够指导他们在项目中实现流畅、高效的图形渲染,满足现代游戏、图形设计、科学可视化等领域的技术需求。
glAccum − operate on the accumulation buffer
C SPECIFICATION
void glAccum( GLenum op, GLfloat value )
PARAMETERS
op Specifies the accumulation buffer operation. Symbolic constants GL_ACCUM,
GL_LOAD, GL_ADD, GL_MULT, and GL_RETURN are accepted.
value Specifies a floating−point value used in the accumulation buffer operation. op
determines how value is used.
DESCRIPTION
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,
respectively. Regardless of the number of bits per component, however, 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 second argument, value, is a floating−point value to be
used in that operation. 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 are applied
identically to the red, green, blue, and alpha components of each pixel. The contents of an
accumulation buffer pixel component are undefined if the glAccum operation results in a value outside
the range [−1,1]. 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 2
n
− 1, where n is the number
of bits allocated to each color component in the currently selected buffer. The result is
a floating−point value in the range [0,1], which is multiplied by value and added to
the corresponding 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 2
n
− 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
2
n
− 1, clamped to the range [0, 2
n
− 1 ], and stored in the corresponding display
buffer cell. The only fragment operations that are applied to this transfer are pixel
ownership, scissor, dithering, and color writemasks.
The accumulation buffer is cleared by specifying R, G, B, and A values to set it to with the
31
glClearAccum directive, and issuing a glClear command with the accumulation buffer enabled.
NOTES
Only those pixels within the current scissor box are updated by any glAccum operation.
ERRORS
GL_INVALID_ENUM is generated if op is not an accepted value.
GL_INVALID_OPERATION is generated if there is no accumulation buffer.
GL_INVALID_OPERATION is generated if glAccum is called between a call to glBegin and the
corresponding call to glEnd.
ASSOCIATED GETS
glGet with argument GL_ACCUM_RED_BITS
glGet with argument GL_ACCUM_GREEN_BITS
glGet with argument GL_ACCUM_BLUE_BITS
glGet with argument GL_ACCUM_ALPHA_BITS
SEE ALSO
"glBlendFunc", "glClear" , "glClearAccum" , "glCopyPixels" , "glGet" ,"glLogicOp" ,"glPixelStore" ,
"glPixelTransfer" , "glReadPixels" , "glReadBuffer" , "glScissor" , "glStencilOp"
glAlphaFunc
NAME
glAlphaFunc − specify the alpha test function
C SPECIFICATION
void glAlphaFunc( GLenum func, GLclampf ref )
PARAMETERS
func Specifies the alpha comparison function. Symbolic constants GL_NEVER, GL_LESS
, GL_EQUAL, GL_LEQUAL, GL_GREATER, GL_NOTEQUAL, GL_GEQUAL, and
GL_ALWAYS are accepted. The default function is GL_ALWAYS.
ref Specifies the reference value that incoming alpha values are compared to. This value
is clamped to the range 0 through 1, where 0 represents the lowest possible alpha
value and 1 the highest possible value. The default reference is 0.
DESCRIPTION
The alpha test discards fragments depending on the outcome of a comparison between the incoming
fragment’s alpha value and a constant reference value. glAlphaFunc specifies the reference and
comparison function. The comparison is performed only if alpha testing is 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 comparison passes, the incoming fragment
is drawn, conditional on subsequent stencil and depth buffer tests. If the comparison fails, no change is
32
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.
glAlphaFunc operates on all pixel writes, including those resulting from the scan conversion of points,
lines, polygons, and bitmaps, and from pixel draw and copy operations. glAlphaFunc does not affect
screen clear operations.
NOTES
Alpha testing is done only in RGBA mode.
ERRORS
GL_INVALID_ENUM is generated if func is not an accepted value.
GL_INVALID_OPERATION is generated if glAlphaFunc is called between a call to glBegin and the
corresponding call to glEnd.
ASSOCIATED GETS
glGet with argument GL_ALPHA_TEST_FUNC
glGet with argument GL_ALPHA_TEST_REF
glIsEnabled with argument GL_ALPHA_TEST
SEE ALSO
"glBlendFunc", "glClear" , "glDepthFunc" , "glEnable" , "glStencilFunc"
glBegin
NAME
glBegin, glEnd − delimit the vertices of a primitive or a group of like primitives
C SPECIFICATION
void glBegin( GLenum mode )
PARAMETERS
mode Specifies the primitive or primitives that will be created from vertices presented
between glBegin and the subsequent glEnd. Ten symbolic constants are accepted:
GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_LINE_LOOP, GL_TRIANGLES,
GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_QUADS, GL_QUAD_STRIP,
and GL_POLYGON.
33
C SPECIFICATION
void glEnd( void )
DESCRIPTION
glBegin and glEnd delimit the vertices that define a primitive or a group of like primitives. glBegin
accepts a single argument that specifies which of ten ways the vertices are interpreted. Taking n as an
integer count starting at one, and N as the total number of vertices specified, the interpretations are as
follows:
GL_POINTS Treats each vertex as a single point. Vertex n defines point n. N points are drawn.
GL_LINES Treates each pair of vertices as an independent line segment. Vertices 2n−1 and 2n
define line n. N/2 lines are drawn.
GL_LINE_STRIP
Draws a connected group of line segments from the first vertex to the last. Vertices n
and n+1 define line n. N−1 lines drawn.
GL_LINE_LOOP
Draws a connected group of line segments from the first vertex to the last, then back
to the first. Vertices n and n+1 define line n. The last line, however, is defined by
vertices N and 1. N lines are drawn.
GL_TRIANGLES
Treates each triplet of vertices as an independent triangle. Vertices 3n−2, 3n−1, and
3n define triangle n. N/3 triangles are drawn.
GL_TRIANGLE_STRIP
Draws a connected group of triangles. One triangle is defined for each vertex
presented after the first two vertices. For odd n, vertices n, n+1, and n+2 define
triangle n. For even n, vertices n+1, n, and n+2 define triangle n. N−2 triangles are
drawn.
GL_TRIANGLE_FAN
Draws a connected group of triangles. One triangle is defined for each vertex
presented after the first two vertices. Vertices 1, n+1, and n+2 define triangle n. N−2
triangles are drawn.
GL_QUADS Treats each group of four vertices as an independent quadrilateral. Vertices 4n−3,
4n−2, 4n−1, and 4n define quadrilateral n. N/4 quadrilaterals are drawn.
GL_QUAD_STRIP
Draws a connected group of quadrilaterals. One quadrilateral is defined for each pair
of vertices presented after the first pair. Vertices 2n−1, 2n, 2n+2, and 2n+1 define
quadrilateral n. N/2−1 quadrilaterals are drawn. Note that the order in which
vertices are used to construct a quadrilateral from strip data is different from that
used with independent data.
GL_POLYGON
Draws a single, convex polygon. Vertices 1 through N define this polygon.
Only a subset of GL commands can be used between glBegin and glEnd. The commands are glVertex
, glColor, glIndex, glNormal, glTexCoord, glEvalCoord, glEvalPoint, glMaterial, and
glEdgeFlag. Also, it is acceptable to use glCallList or glCallLists to execute display lists that
include only the preceding commands. If any other GL command is called between glBegin and glEnd,
the error flag is set and the command is ignored.
Regardless of the value chosen for mode, there is no limit to the number of vertices that can be defined
between glBegin and glEnd. Lines, triangles, quadrilaterals, and polygons that are incompletely
specified are not drawn. Incomplete specification results when either too few vertices are provided to
specify even a single primitive or when an incorrect multiple of vertices is specified. The incomplete
primitive is ignored; the rest are drawn.
34
The minimum specification of vertices for each primitive is as follows: 1 for a point, 2 for a line, 3 for a
triangle, 4 for a quadrilateral, and 3 for a polygon. Modes that require a certain multiple of vertices are
GL_LINES (2), GL_TRIANGLES (3), GL_QUADS (4), and GL_QUAD_STRIP (2).
ERRORS
GL_INVALID_ENUM is generated if mode is set to an unaccepted value.
GL_INVALID_OPERATION is generated if a command other than glVertex, glColor, glIndex,
glNormal, glTexCoord, glEvalCoord, glEvalPoint, glMaterial, glEdgeFlag, glCallList, or
glCallLists is called between glBegin and the corresponding glEnd.
GL_INVALID_OPERATION is generated if glEnd is called before the corresponding glBegin is
called, or if glBegin is called within a glBegin/glEnd sequence.
SEE ALSO
"glCallList", "glCallLists" , "glColor" , "glEdgeFlag" , "glEvalCoord" , "glEvalPoint" , "glIndex" ,
"glMaterial" , "glNormal" , "glTexCoord" , "glVertex"
glBitmap
NAME
glBitmap − draw a bitmap
C SPECIFICATION
void glBitmap( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat
ymove, const GLubyte *bitmap )
PARAMETERS
width, height Specify the pixel width and height of the bitmap image.
xorig, yorig Specify the location of the origin in the bitmap image. The origin is measured from
the lower left corner of the bitmap, with right and up being the positive axes.
xmove, ymove Specify the x and y offsets to be added to the current raster position after the bitmap is
drawn.
bitmap Specifies the address of the bitmap image.
DESCRIPTION
A bitmap is a binary image. When drawn, the bitmap is positioned relative to the current raster
position, and frame buffer pixels corresponding to ones in the bitmap are written using the current
raster color or index. Frame buffer pixels corresponding to zeros in the bitmap are not modified.
glBitmap takes seven arguments. The first pair specify the width and height of the bitmap image.
The second pair specify the location of the bitmap origin relative to the lower left corner of the bitmap
image. The third pair of arguments specify x and y offsets to be added to the current raster position
after the bitmap has been drawn. The final argument is a pointer to the bitmap image itself.
The bitmap image is interpreted like image data for the glDrawPixels command, with width and
height corresponding to the width and height arguments of that command, and with type set to
GL_BITMAP and format set to GL_COLOR_INDEX. Modes specified using glPixelStore affect the
interpretation of bitmap image data; modes specified using glPixelTransfer do not.
If the current raster position is invalid, glBitmap is ignored. Otherwise, the lower left corner of the
35
bitmap image is positioned at the window coordinates
where ( x
r
, y
r
) is the raster position and ( x
o
, y
o
) is the bitmap origin. Fragments are then
generated for each pixel corresponding to a one in the bitmap image. These fragments are generated
using the current raster z coordinate, color or color index, and current raster texture coordinates. They
are then treated just as if they had been generated by a point, line, or polygon, including texture
mapping, fogging, and all per−fragment operations such as alpha and depth testing.
After the bitmap has been drawn, the x and y coordinates of the current raster position are offset by
xmove and ymove. No change is made to the z coordinate of the current raster position, or to the current
raster color, index, or texture coordinates.
ERRORS
GL_INVALID_VALUE is generated if width or height is negative.
GL_INVALID_OPERATION is generated if glBitmap is called between a call to glBegin and the
corresponding call to glEnd.
ASSOCIATED GETS
glGet with argument GL_CURRENT_RASTER_POSITION
glGet with argument GL_CURRENT_RASTER_COLOR
glGet with argument GL_CURRENT_RASTER_INDEX
glGet with argument GL_CURRENT_RASTER_TEXTURE_COORDS
glGet with argument GL_CURRENT_RASTER_POSITION_VALID
SEE ALSO
"glDrawPixels", "glRasterPos" , "glPixelStore" , "glPixelTransfer"
glBlendFunc
NAME
glBlendFunc − specify pixel arithmetic
C SPECIFICATION
void glBlendFunc( GLenum sfactor, GLenum dfactor )
PARAMETERS
sfactor Specifies how the red, green, blue, and alpha source−blending factors are computed.
36
Nine symbolic constants are accepted: GL_ZERO, GL_ONE, GL_DST_COLOR,
GL_ONE_MINUS_DST_COLOR, GL_SRC_ALPHA,
GL_ONE_MINUS_SRC_ALPHA, GL_DST_ALPHA,
GL_ONE_MINUS_DST_ALPHA, and GL_SRC_ALPHA_SATURATE.
dfactor Specifies how the red, green, blue, and alpha destination blending factors are
computed. Eight symbolic constants are accepted: GL_ZERO, GL_ONE,
GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_SRC_ALPHA,
GL_ONE_MINUS_SRC_ALPHA, GL_DST_ALPHA, and
GL_ONE_MINUS_DST_ALPHA.
DESCRIPTION
In RGB 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). By default,
blending is disabled. Use glEnable and glDisable with argument GL_BLEND to enable and disable
blending.
glBlendFunc defines the operation of blending when it is enabled. sfactor specifies which of nine
methods is used to scale the source color components. dfactor specifies which of eight methods is used
to scale the destination color components. The eleven possible methods are described in the table
below. Each method defines four scale factors, one each for red, green, blue, and alpha.
In the table and in subsequent equations, source and destination color components are referred to as (R
s
, G
s
, B
s
, A
s
) and (R
d
, G
d
, B
d
, A
d
). They are understood to have integer values between zero and (k
R
, k
G
, k
B
, k
A
), where
and (m
R
, m
G
, m
B
, m
A
) is the number of red, green, blue, and alpha bitplanes.
Source and destination scale factors are referred to as (s
R
, s
G
, s
B
, s
A
) and (d
R
, d
G
, d
B
, d
A
). The
scale factors described in the table, denoted (f
R
, f
G
, f
B
, f
A
), represent either source or destination
factors. All scale factors have range [0,1].
parameter
(f
R
, f
G
, f
B
, f
A
)
GL_ZERO (0, 0, 0, 0 )
GL_ONE (1, 1, 1, 1 )
GL_SRC_COLOR (
R
s
/ k
R
, G
s
/ k
G
, B
s
/ k
B
, A
s
/ k
A
)
GL_ONE_MINUS_SRC_COLOR (1, 1, 1, 1 )
−
(
R
s
/ k
R
, G
s
/ k
G
, B
s
/ k
B
, A
s
/ k
A
)
GL_DST_COLOR (
R
d
/ k
R
, G
d
/ k
G
, B
d
/ k
B
, A
d
/ k
A
)
GL_ONE_MINUS_DST_COLOR (1, 1, 1, 1 )
− (R
d
/ k
R
, G
d
/ k
G
, B
d
/ k
B
, A
d
/ k
A
)
GL_SRC_ALPHA
(A
s
/ k
A
, A
s
/ k
A
, A
s
/ k
A
, A
s
/ k
A
)
GL_ONE_MINUS_SRC_ALPHA (1, 1, 1, 1 )
−
(
A
s
/ k
A
, A
s
/ k
A
, A
s
/ k
A
, A
s
/ k
A
)
GL_DST_ALPHA (
A
d
/ k
A
, A
d
/ k
A
, A
d
/ k
A
, A
d
/ k
A
)
GL_ONE_MINUS_DST_ALPHA (1, 1, 1, 1 )
−
(
A
d
/ k
A
, A
d
/ k
A
, A
d
/ k
A
, A
d
/ k
A
)
GL_SRC_ALPHA_SATURATE (
i, i, i,
1 )
In the table,
i = min (A
s
, k
A
− A
d
) / k
A
To determine the blended RGBA values of a pixel when drawing in RGB mode, the system uses the
following equations:
37
R
d
= min ( k
R
, R
s
s
R
+ R
d
d
R
)
G
d
= min ( k
G
, G
s
s
G
+ G
d
d
G
)
B
d
= min ( k
B
, B
s
s
B
+ B
d
d
B
)
A
d
= min ( k
A
, A
s
s
A
+ A
d
d
A
)
Despite the apparent precision of the above equations, blending arithmetic is not exactly specified,
because blending operates with imprecise integer color values. However, a blend factor that should be
equal to one is guaranteed not to modify its multiplicand, and a blend factor equal to zero reduces its
multiplicand to zero. Thus, for example, when sfactor is GL_SRC_ALPHA, dfactor is
GL_ONE_MINUS_SRC_ALPHA, and A
s
is equal to k
A
, the equations reduce to simple replacement:
R
d
= R
s
G
d
= G
s
B
d
= B
s
A
d
= A
s
EXAMPLES
Transparency is best implemented using blend function (GL_SRC_ALPHA,
GL_ONE_MINUS_SRC_ALPHA) with primitives sorted from farthest to nearest. Note that this
transparency calculation does not require the presence of alpha bitplanes in the frame buffer.
Blend function (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) is also useful for rendering
antialiased points and lines in arbitrary order.
Polygon antialiasing is optimized using blend function (GL_SRC_ALPHA_SATURATE, GL_ONE)
with polygons sorted from nearest to farthest. (See the "glEnable" , glDisable reference page and the
GL_POLYGON_SMOOTH argument for information on polygon antialiasing.) Destination alpha
bitplanes, which must be present for this blend function to operate correctly, store the accumulated
coverage.
NOTES
Incoming (source) alpha is correctly thought of as a material opacity, ranging from 1.0 (K
A
),
representing complete opacity, to 0.0 (0), representing completely transparency.
When more than one color buffer is enabled for drawing, blending is done separately for each enabled
buffer, using for destination color the contents of that buffer. (See "glDrawBuffer" .)
Blending affects only RGB rendering. It is ignored by color index renderers.
ERRORS
GL_INVALID_ENUM is generated if either sfactor or dfactor is not an accepted value.
GL_INVALID_OPERATION is generated if glBlendFunc is called between a call to glBegin and the
corresponding call to glEnd.
ASSOCIATED GETS
glGet with argument GL_BLEND_SRC
glGet with argument GL_BLEND_DST
glIsEnabled with argument GL_BLEND
SEE ALSO
"glAlphaFunc", "glClear" , "glDrawBuffer" , "glEnable" , "glLogicOp" , "glStencilFunc"
38
glCallList
NAME
glCallList − execute a display list
C SPECIFICATION
void glCallList( GLuint list )
PARAMETERS
list Specifies the integer name of the display list to be executed.
DESCRIPTION
glCallList causes the named display list to be executed. The commands saved in the display list are
executed in order, just as if they were called without using a display list. If list has not been defined as
a display list, glCallList is ignored.
glCallList can appear inside a display list. To avoid the possibility of infinite recursion resulting from
display lists calling one another, a limit is placed on the nesting level of display lists during
display−list execution. This limit is at least 64, and it depends on the implementation.
GL state is not saved and restored across a call to glCallList. Thus, changes made to GL state during
the execution of a display list remain after execution of the display list is completed. Use
glPushAttrib, glPopAttrib, glPushMatrix, and glPopMatrix to preserve GL state across
glCallList calls.
NOTES
Display lists can be executed between a call to glBegin and the corresponding call to glEnd, as long as
the display list includes only commands that are allowed in this interval.
ASSOCIATED GETS
glGet with argument GL_MAX_LIST_NESTING
glIsList
SEE ALSO
"glCallLists", "glDeleteLists" , "glGenLists" , "glNewList" , "glPushAttrib" , "glPushMatrix"
glCallLists
NAME
glCallLists − execute a list of display lists
C SPECIFICATION
void glCallLists( GLsizei n, GLenum type, const GLvoid *lists )
PARAMETERS
n Specifies the number of display lists to be executed.
39
type Specifies the type of values in lists. Symbolic constants GL_BYTE,
GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT, GL_INT,
GL_UNSIGNED_INT, GL_FLOAT, GL_2_BYTES, GL_3_BYTES, and
GL_4_BYTES are accepted.
lists Specifies the address of an array of name offsets in the display list. The pointer type
is void because the offsets can be bytes, shorts, ints, or floats, depending on the value
of type.
DESCRIPTION
glCallLists causes each display list in the list of names passed as lists to be executed. As a result, the
commands saved in each display list are executed in order, just as if they were called without using a
display list. Names of display lists that have not been defined are ignored.
glCallLists provides an efficient means for executing display lists. n allows lists with various name
formats to be accepted. The formats are as follows:
GL_BYTE lists is treated as an array of signed bytes, each in the range −128 through 127.
GL_UNSIGNED_BYTE
lists is treated as an array of unsigned bytes, each in the range 0 through 255.
GL_SHORT lists is treated as an array of signed two−byte integers, each in the range −32768
through 32767.
GL_UNSIGNED_SHORT
lists is treated as an array of unsigned two−byte integers, each in the range 0 through
65535.
GL_INT lists is treated as an array of signed four−byte integers.
GL_UNSIGNED_INT
lists is treated as an array of unsigned four−byte integers.
GL_FLOAT lists is treated as an array of four−byte floating−point values.
GL_2_BYTES lists is treated as an array of unsigned bytes. Each pair of bytes specifies a single
display−list name. The value of the pair is computed as 256 times the unsigned value
of the first byte plus the unsigned value of the second byte.
GL_3_BYTES lists is treated as an array of unsigned bytes. Each triplet of bytes specifies a single
display−list name. The value of the triplet is computed as 65536 times the unsigned
value of the first byte, plus 256 times the unsigned value of the second byte, plus the
unsigned value of the third byte.
GL_4_BYTES lists is treated as an array of unsigned bytes. Each quadruplet of bytes specifies a
single display−list name. The value of the quadruplet is computed as 16777216 times
the unsigned value of the first byte, plus 65536 times the unsigned value of the second
byte, plus 256 times the unsigned value of the third byte, plus the unsigned value of
the fourth byte.
The list of display list names is not null−terminated. Rather, n specifies how many names are to be
taken from lists.
An additional level of indirection is made available with the glListBase command, which specifies an
unsigned offset that is added to each display−list name specified in lists before that display list is
executed.
glCallLists can appear inside a display list. To avoid the possibility of infinite recursion resulting
from display lists calling one another, a limit is placed on the nesting level of display lists during
display−list execution. This limit must be at least 64, and it depends on the implementation.
GL state is not saved and restored across a call to glCallLists. Thus, changes made to GL state during
the execution of the display lists remain after execution is completed. Use glPushAttrib,
glPopAttrib, glPushMatrix, and glPopMatrix to preserve GL state across glCallLists calls.
40
剩余118页未读,继续阅读
点击了解资源详情
点击了解资源详情
点击了解资源详情
2009-02-17 上传
2010-07-26 上传
2008-07-11 上传
2018-05-07 上传
2010-04-05 上传
kekok
- 粉丝: 4
- 资源: 155
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Angular实现MarcHayek简历展示应用教程
- Crossbow Spot最新更新 - 获取Chrome扩展新闻
- 量子管道网络优化与Python实现
- Debian系统中APT缓存维护工具的使用方法与实践
- Python模块AccessControl的Windows64位安装文件介绍
- 掌握最新*** Fisher资讯,使用Google Chrome扩展
- Ember应用程序开发流程与环境配置指南
- EZPCOpenSDK_v5.1.2_build***版本更新详情
- Postcode-Finder:利用JavaScript和Google Geocode API实现
- AWS商业交易监控器:航线行为分析与营销策略制定
- AccessControl-4.0b6压缩包详细使用教程
- Python编程实践与技巧汇总
- 使用Sikuli和Python打造颜色求解器项目
- .Net基础视频教程:掌握GDI绘图技术
- 深入理解数据结构与JavaScript实践项目
- 双子座在线裁判系统:提高编程竞赛效率
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功