Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

The Official Guide to Learning OpenGL, Version 1.1 (Redbook Second Edition)

.pdf
Скачиваний:
198
Добавлен:
02.05.2014
Размер:
8.22 Mб
Скачать

OpenGL Programming Guide (Addison-Wesley Publishing Company)

The pixel copy operation is similar to a combination of the unpacking and transfer operations, except that packing and unpacking is unnecessary, and only a single pass is made through the transfer operations before the data is written back into the framebuffer.

Texture Memory

OpenGL Version 1.1 provides additional control over texture memory. Texture image data can be specified from framebuffer memory, as well as processor memory. All or a portion of a texture image may be replaced. Texture data may be stored in texture objects, which can be loaded into texture memory. If there are too many texture objects to fit into texture memory at the same time, the textures that have the highest priorities remain in the texture memory.

Fragment Operations

If texturing is enabled, a texel is generated from texture memory for each fragment and applied to the fragment. Then fog calculations are performed, if they're enabled, followed by the application of coverage (antialiasing) values, if antialiasing is enabled.

Next comes scissoring, followed by the alpha test (in RGBA mode only), the stencil test, and the depth-buffer test. If in RGBA mode, blending is performed. Blending is followed by dithering and logical operation. All these operations may be disabled.

The fragment is then masked by a color mask or an index mask, depending on the mode, and drawn into the appropriate buffer. If fragments are being written into the stencil or depth buffer, masking occurs after the stencil and depth tests, and the results are drawn into the framebuffer without performing the blending, dithering, or logical operation.

Odds and Ends

Matrix operations deal with the current matrix stack, which can be the modelview, the projection, or the texture matrix stack. The commands glMultMatrix*(), glLoadMatrix*(), and glLoadIdentity() are applied to the top matrix on the stack, while glTranslate*(), glRotate*(), glScale*(), glOrtho(), and glFrustum() are used to create a matrix that's multiplied by the top matrix. When the modelview matrix is modified, its inverse transpose is also generated for normal vector transformation.

The commands that set the current raster position are treated exactly like a vertex command up until when rasterization would occur. At this point, the value is saved and is used in the rasterization of pixel data.

The various glClear() commands bypass all operations except scissoring, dithering, and writemasking.

OpenGL Programming Guide (Addison-Wesley Publishing Company)

http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaw...Generic__BookTextView/29478;cs=fullhtml;pt=28086 (4 of 4) [4/28/2000 9:49:28 PM]

OpenGL Programming Guide (Addison-Wesley Publishing Company)

OpenGL Programming Guide (Addison-Wesley Publishing Company)

Appendix B

State Variables

This appendix lists the queryable OpenGL state variables, their default values, and the commands for obtaining the values of these variables. The OpenGL Reference Manual contains detailed information on all the commands and constants discussed in this appendix. This appendix has these major sections:

"The Query Commands"

"OpenGL State Variables"

The Query Commands

In addition to the basic commands to obtain the values of simple state variables (commands such as glGetIntegerv() and glIsEnabled(), which are described in "Basic State Management" in Chapter 2), there are other specialized commands to return more complex state variables. The prototypes for these specialized commands are listed here. Some of these routines, such as glGetError() and glGetString(), have been discussed in more detail elsewhere in the book.

To find out when you need to use these commands and their corresponding symbolic constants, use the tables in the next section, "OpenGL State Variables." Also see the OpenGL Reference Manual.

void glGetClipPlane(GLenum plane, GLdouble *equation);

GLenum glGetError(void);

void glGetLight{if}v(GLenum light, GLenum pname, TYPE *params); void glGetMap{ifd}v(GLenum target, GLenum query, TYPE *v);

void glGetMaterial{if}v(GLenum face, GLenum pname, TYPE *params); void glGetPixelMap{f ui us}v(GLenum map, TYPE *values);

void glGetPolygonStipple(GLubyte *mask);

const GLubyte * glGetString(GLenum name);

void glGetTexEnv{if}v(GLenum target, GLenum pname, TYPE *params);

void glGetTexGen{ifd}v(GLenum coord, GLenum pname, TYPE *params);

void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);

void glGetTexLevelParameter{if}v(GLenum target, GLint level, GLenum pname, TYPE *params);

void glGetTexParameter{if}v(GLenum target, GLenum pname, TYPE *params);

void gluGetNurbsProperty(GLUnurbsObj *nobj, GLenum property, GLfloat *value);

const GLubyte * gluGetString(GLenum name);

http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaw...Generic__BookTextView/29704;cs=fullhtml;pt=29478 (1 of 21) [4/28/2000 9:49:47 PM]

OpenGL Programming Guide (Addison-Wesley Publishing Company)

void gluGetTessProperty(GLUtesselator *tess, GLenum which, GLdouble *data);

OpenGL State Variables

The following pages contain tables that list the names of queryable state variables. For each variable, the tables list a description of it, its attribute group, its initial or minimum value, and the suggested glGet*() command to use for obtaining it. State variables that can be obtained using glGetBooleanv(), glGetIntegerv(), glGetFloatv(), or glGetDoublev() are listed with just one of these commands - the one that's most appropriate given the type of data to be returned. (Some vertex array variables can be queried only with glGetPointerv().) These state variables can't be obtained using glIsEnabled(). However, state variables for which glIsEnabled() is listed as the query command can also be obtained using glGetBooleanv(), glGetIntegerv(), glGetFloatv(), and glGetDoublev(). State variables for which any other command is listed as the query command can be obtained only by using that command.

If one or more attribute groups are listed, the state variable belongs to the listed group or groups. If no attribute group is listed, the variable doesn't belong to any group. glPushAttrib(), glPushClientAttrib(), glPopAttrib(), and glPopClientAttrib() may be used to save and restore all state values that belong to an attribute group. (See "Attribute Groups" in Chapter 2 for more information.)

All queryable state variables, except the implementation-dependent ones, have initial values. If no initial value is listed, you need to consult either the section where that variable is discussed or the OpenGL Reference Manual to determine its initial value.

Current Values and Associated Data

Table B-1 : State Variables for Current Values and Associated Data

http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaw...Generic__BookTextView/29704;cs=fullhtml;pt=29478 (2 of 21) [4/28/2000 9:49:47 PM]

OpenGL Programming Guide (Addison-Wesley Publishing Company)

Vertex Array

Table B-2 : (continued) Vertex Array State Variables

http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaw...Generic__BookTextView/29704;cs=fullhtml;pt=29478 (3 of 21) [4/28/2000 9:49:47 PM]

OpenGL Programming Guide (Addison-Wesley Publishing Company)

GL_NORMAL_ARRAY_TYPE

Type of normal

vertex-array

GL_FLOAT

glGetIntegerv()

 

coordinates

 

 

 

GL_NORMAL_ARRAY_STRIDE

Stride between

vertex-array

0

glGetIntegerv()

 

normals

 

 

 

GL_NORMAL_ARRAY_POINTER

Pointer to the

vertex-array

NULL

glGetPointerv()

 

normal array

 

 

 

GL_COLOR_ARRAY

RGBA color

vertex-array

GL_FALSE

glIsEnabled()

 

array enable

 

 

 

GL_COLOR_ARRAY_SIZE

Colors per

vertex-array

4

glGetIntegerv()

 

vertex

 

 

 

GL_COLOR_ARRAY_TYPE

Type of color

vertex-array

GL_FLOAT

glGetIntegerv()

 

components

 

 

 

GL_COLOR_ARRAY_STRIDE

Stride between

vertex-array

0

glGetIntegerv()

 

colors

 

 

 

GL_COLOR_ARRAY_POINTER

Pointer to the

vertex-array

NULL

glGetPointerv()

 

color array

 

 

 

GL_INDEX_ARRAY

Color-index

vertex-array

GL_FALSE

glIsEnabled()

 

array enable

 

 

 

GL_INDEX_ARRAY_TYPE

Type of color

vertex-array

GL_FLOAT

glGetIntegerv()

 

indices

 

 

 

GL_INDEX_ARRAY_STRIDE

Stride between

vertex-array

0

glGetIntegerv()

 

color indices

 

 

 

GL_INDEX_ARRAY_POINTER

Pointer to the

vertex-array

NULL

glGetPointerv()

 

index array

 

 

 

GL_TEXTURE_COORD_ARRAY

Texture

vertex-array

GL_FALSE

glIsEnabled()

 

coordinate array

 

 

 

 

enable

 

 

 

GL_TEXTURE_COORD_ARRAY_SIZE

Texture

vertex-array

4

glGetIntegerv()

 

coordinates per

 

 

 

 

element

 

 

 

GL_TEXTURE_COORD_ARRAY_TYPE

Type of texture

vertex-array

GL_FLOAT

glGetIntegerv()

 

coordinates

 

 

 

 

 

 

 

 

http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaw...Generic__BookTextView/29704;cs=fullhtml;pt=29478 (4 of 21) [4/28/2000 9:49:47 PM]

OpenGL Programming Guide (Addison-Wesley Publishing Company)

Transformation

Table B-3 : Transformation State Variables

http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaw...Generic__BookTextView/29704;cs=fullhtml;pt=29478 (5 of 21) [4/28/2000 9:49:47 PM]

OpenGL Programming Guide (Addison-Wesley Publishing Company)

Coloring

Table B-4 : Coloring State Variables

Lighting

See also Table 5-1 and Table 5-3 for initial values.

Table B-5 : (continued) Lighting State Variables

http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaw...Generic__BookTextView/29704;cs=fullhtml;pt=29478 (6 of 21) [4/28/2000 9:49:47 PM]

OpenGL Programming Guide (Addison-Wesley Publishing Company)

http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaw...Generic__BookTextView/29704;cs=fullhtml;pt=29478 (7 of 21) [4/28/2000 9:49:48 PM]

OpenGL Programming Guide (Addison-Wesley Publishing Company)

Rasterization

Table B-6 : (continued) Rasterization State Variables

http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaw...Generic__BookTextView/29704;cs=fullhtml;pt=29478 (8 of 21) [4/28/2000 9:49:48 PM]

OpenGL Programming Guide (Addison-Wesley Publishing Company)

GL_POINT_SIZE

Point size

point

1.0

glGetFloatv()

GL_POINT_SMOOTH

Point antialiasing on

point/enable

GL_FALSE

glIsEnabled()

GL_LINE_WIDTH

Line width

line

1.0

glGetFloatv()

GL_LINE_SMOOTH

Line antialiasing on

line/enable

GL_FALSE

glIsEnabled()

GL_LINE_STIPPLE_PATTERN

Line stipple

line

1's

glGetIntegerv()

GL_LINE_STIPPLE_REPEAT

Line stipple repeat

line

1

glGetIntegerv()

GL_LINE_STIPPLE

Line stipple enable

line/enable

GL_FALSE

glIsEnabled()

GL_CULL_FACE

Polygon culling enabled

polygon/enable

GL_FALSE

glIsEnabled()

GL_CULL_FACE_MODE

Cull front-/back-facing

polygon

GL_BACK

glGetIntegerv()

 

polygons

 

 

 

GL_FRONT_FACE

Polygon front-face

polygon

GL_CCW

glGetIntegerv()

 

CW/CCW

 

 

 

 

indicator

 

 

 

GL_POLYGON_SMOOTH

Polygon antialiasing on

polygon/enable

GL_FALSE

glIsEnabled()

GL_POLYGON_MODE

Polygon rasterization

polygon

GL_FILL

glGetIntegerv()

 

mode (front and back)

 

 

 

GL_POLYGON_OFFSET_FACTOR

Polygon offset factor

polygon

0

glGetFloatv()

GL_POLYGON_OFFSET_BIAS

Polygon offset bias

polygon

0

glGetFloatv()

GL_POLYGON_OFFSET_POINT

Polygon offset enable

polygon/enable

GL_FALSE

glIsEnabled()

 

for GL_POINT mode

 

 

 

 

rasterization

 

 

 

GL_POLYGON_OFFSET_LINE

Polygon offset enable

polygon/enable

GL_FALSE

glIsEnabled()

 

for GL_LINE mode

 

 

 

 

rasterization

 

 

 

GL_POLYGON_OFFSET_FILL

Polygon offset enable

polygon/enable

GL_FALSE

glIsEnabled()

 

for GL_FILL mode

 

 

 

 

rasterization

 

 

 

GL_POLYGON_STIPPLE

Polygon stipple enable

polygon/enable

GL_FALSE

glIsEnabled()

-

Polygon stipple pattern

polygon-stipple

1's

glGetPolygon-

 

 

 

 

Stipple()

 

 

 

 

 

http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaw...Generic__BookTextView/29704;cs=fullhtml;pt=29478 (9 of 21) [4/28/2000 9:49:48 PM]

Соседние файлы в предмете Разработка игр