15. 3D Vector Graphics

  Module GL

Description

Not implemented OpenGL methods:

glAreTexturesResident
glBitmap
glBlendColorEXT
glCallLists
glColorPointer
glDeleteTextures
glDrawElements
glEdgeFlagPointer
glEdgeFlagv
glEvalMesh
glFeedbackBuffer
glGenTextures
glGetBooleanv
glGetClipPlane
glGetDoublev
glGetFloatv
glGetIntegerv
glGetLight
glGetMap
glGetMaterial
glGetPixelMap
glGetPointerv
glGetPolygonStipple
glGetTexEnv
glGetTexGen
glGetTexImage
glGetTexLevelParameter
glGetTexParameter
glIndexPointer
glInterleavedArrays
glMap1
glMap2
glMapGrid
glNormalPointer
glPixelMap
glPixelStore
glPixelTransfer
glPolygonStipple
glPrioritizeTextures
glReadPixels
glRect
glSelectBuffer
glTexCoordPointer
glTexImage1D
glTexSubImage1D
glVertexPointer


Method glAccum

void GL.glAccum(int op, float value)

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.GL_ACCUM_RED_BITS, GL.GL_ACCUM_GREEN_BITS, GL.GL_ACCUM_BLUE_BITS, and GL.GL_ACCUM_ALPHA_BITS. Regardless 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.

GL.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.GL_ACCUM, GL.GL_LOAD, GL.GL_ADD, GL.GL_MULT, and GL.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 components of each pixel. If a GL.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.GL_ACCUM Obtains R, G, B, and A values from the buffer currently selected for reading (see GL.glReadBuffer). Each component value is divided by 2n1, 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.GL_LOAD Similar to GL.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 2n1, multiplied by value, and then stored in the corresponding accumulation buffer cell, overwriting the current value.
GL.GL_ADD Adds value to each R, G, B, and A in the accumulation buffer.
GL.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.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 2n1, clamped to the range [0, 2n1 ], 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.

To clear the accumulation buffer, call GL.glClearAccum with R, G, B, and A values to set it to, then call GL.glClear with the accumulation buffer enabled.

Parameter op

Specifies the accumulation buffer operation. Symbolic constants GL.GL_ACCUM, GL.GL_LOAD, GL.GL_ADD, GL.GL_MULT, and GL.GL_RETURN are accepted.

Parameter value

Specifies a floating-point value used in the accumulation buffer operation. op determines how value is used.

Throws

GL.GL_INVALID_ENUM is generated if op is not an accepted value.

GL.GL_INVALID_OPERATION is generated if there is no accumulation buffer.

GL.GL_INVALID_OPERATION is generated if GL.glAccum is executed between the execution of GL.glBegin and the corresponding execution of GL.glEnd.


Method glAlphaFunc

void GL.glAlphaFunc(int func, float ref)

Description

The alpha test discards fragments depending on the outcome of a comparison between an incoming fragment's alpha value and a constant reference value. GL.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 GL.glEnable and GL.glDisable of GL.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.GL_NEVER Never passes.
GL.GL_LESS Passes if the incoming alpha value is less than the reference value.
GL.GL_EQUAL Passes if the incoming alpha value is equal to the reference value.
GL.GL_LEQUAL Passes if the incoming alpha value is less than or equal to the reference value.
GL.GL_GREATER Passes if the incoming alpha value is greater than the reference value.
GL.GL_NOTEQUAL Passes if the incoming alpha value is not equal to the reference value.
GL.GL_GEQUAL Passes if the incoming alpha value is greater than or equal to the reference value.
GL.GL_ALWAYS Always passes (initial value).

GL.glAlphaFunc operates on all pixel write operations, including those resulting from the scan conversion of points, lines, polygons, and bitmaps, and from pixel draw and copy operations. GL.glAlphaFunc does not affect screen clear operations.

Parameter func

Specifies the alpha comparison function. Symbolic constants GL.GL_NEVER, GL.GL_LESS, GL.GL_EQUAL, GL.GL_LEQUAL, GL.GL_GREATER, GL.GL_NOTEQUAL, GL.GL_GEQUAL, and GL.GL_ALWAYS are accepted. The initial value is GL.GL_ALWAYS.

Parameter 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 initial reference value is 0.

Throws

GL.GL_INVALID_ENUM is generated if func is not an accepted value.

GL.GL_INVALID_OPERATION is generated if GL.glAlphaFunc is executed between the execution of GL.glBegin and the corresponding execution of GL.glEnd.


Method glArrayElement

void GL.glArrayElement(int i)

Description

GL.glArrayElement commands are used within GL.glBegin/GL.glEnd pairs to specify vertex and attribute data for point, line, and polygon primitives. If GL.GL_VERTEX_ARRAY is enabled when GL.glArrayElement is called, a single vertex is drawn, using vertex and attribute data taken from location i of the enabled arrays. If GL.GL_VERTEX_ARRAY is not enabled, no drawing occurs but the attributes corresponding to the enabled arrays are modified.

Use GL.glArrayElement to construct primitives by indexing vertex data, rather than by streaming through arrays of data in first-to-last order. Because each call specifies only a single vertex, it is possible to explicitly specify per-primitive attributes such as a single normal per individual triangle.

Changes made to array data between the execution of GL.glBegin and the corresponding execution of GL.glEnd may affect calls to GL.glArrayElement that are made within the same GL.glBegin/GL.glEnd period in non-sequential ways. That is, a call to

GL.glArrayElement that precedes a change to array data may access the changed data, and a call that follows a change to array data may access original data.

Parameter i

Specifies an index into the enabled vertex data arrays.


Method glBindTexture

void GL.glBindTexture(int target, int texture)

Description

GL.glBindTexture lets you create or use a named texture. Calling GL.glBindTexture with

target set to GL.GL_TEXTURE_1D or GL.GL_TEXTURE_2D and texture set to the name of the newtexture binds the texture name to the target. When a texture is bound to a target, the previous binding for that target is automatically broken.

Texture names are unsigned integers. The value zero is reserved to represent the default texture for each texture target. Texture names and the corresponding texture contents are local to the shared display-list space (see glXCreateContext) of the current GL rendering context; two rendering contexts share texture names only if they also share display lists.

You may use glGenTextures to generate a set of new texture names.

When a texture is first bound, it assumes the dimensionality of its target: A texture first bound to GL.GL_TEXTURE_1D becomes 1-dimensional and a texture first bound to GL.GL_TEXTURE_2D becomes 2-dimensional. The state of a 1-dimensional texture immediately after it is first bound is equivalent to the state of the default GL.GL_TEXTURE_1D at GL initialization, and similarly for 2-dimensional textures.

While a texture is bound, GL operations on the target to which it is bound affect the bound texture, and queries of the target to which it is bound return state from the bound texture. If texture mapping of the dimensionality of the target to which a texture is bound is active, the bound texture is used. In effect, the texture targets become aliases for the textures currently bound to them, and the texture name zero refers to the default textures that were bound to them at initialization.

A texture binding created with GL.glBindTexture remains active until a different texture is bound to the same target, or until the bound texture is deleted with glDeleteTextures.

Once created, a named texture may be re-bound to the target of the matching dimensionality as often as needed. It is usually much faster to use GL.glBindTexture to bind an existing named texture to one of the texture targets than it is to reload the texture image using glTexImage1D or GL.glTexImage2D. For additional control over performance, use glPrioritizeTextures.

GL.glBindTexture is included in display lists.

Parameter target

Specifies the target to which the texture is bound. Must be either GL.GL_TEXTURE_1D or GL.GL_TEXTURE_2D.

Parameter texture

Specifies the name of a texture.

Throws

GL.GL_INVALID_ENUM is generated if target is not one of the allowable values.

GL.GL_INVALID_OPERATION is generated if texture has a dimensionality which doesn't match that of target.

GL.GL_INVALID_OPERATION is generated if GL.glBindTexture is executed between the execution of GL.glBegin and the corresponding execution of GL.glEnd.


Method glBlendFunc

void GL.glBlendFunc(int sfactor, int dfactor)

Description

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 GL.glEnable and GL.glDisable with argument GL.GL_BLEND to enable and disable blending.

GL.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 following table. 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 sub s , G sub s , B sub s , A sub s ) and (R sub d , G sub d , B sub d , A sub d ). They are understood to have integer values between 0 and (k sub R , k sub G , k sub B , k sub A ), where

.RS .ce k sub c ~=~ 2 sup m sub c - 1 .RE

and (m sub R , m sub G , m sub B , m sub A ) is the number of red, green, blue, and alpha bitplanes.

Source and destination scale factors are referred to as (s sub R , s sub G , s sub B , s sub A ) and (d sub R , d sub G , d sub B , d sub A ). The scale factors described in the table, denoted (f sub R , f sub G , f sub B , f sub A ), represent either source or destination factors. All scale factors have range [0,1].

.TS center box ; ci | ci c | c . parameter (f sub R , ~~ f sub G , ~~ f sub B , ~~ f sub A ) = GL.GL_ZERO (0, ~0, ~0, ~0 ) GL.GL_ONE (1, ~1, ~1, ~1 ) GL.GL_SRC_COLOR (R sub s / k sub R , ~G sub s / k sub G , ~B sub s / k sub B , ~A sub s / k sub A ) GL.GL_ONE_MINUS_SRC_COLOR (1, ~1, ~1, ~1 ) ~-~ (R sub s / k sub R , ~G sub s / k sub G , ~B sub s / k sub B , ~A sub s / k sub A ) GL.GL_DST_COLOR (R sub d / k sub R , ~G sub d / k sub G , ~B sub d / k sub B , ~A sub d / k sub A ) GL.GL_ONE_MINUS_DST_COLOR (1, ~1, ~1, ~1 ) ~-~ (R sub d / k sub R , ~G sub d / k sub G , ~B sub d / k sub B , ~A sub d / k sub A ) GL.GL_SRC_ALPHA (A sub s / k sub A , ~A sub s / k sub A , ~A sub s / k sub A , ~A sub s / k sub A ) GL.GL_ONE_MINUS_SRC_ALPHA (1, ~1, ~1, ~1 ) ~-~ (A sub s / k sub A , ~A sub s / k sub A , ~A sub s / k sub A , ~A sub s / k sub A ) GL.GL_DST_ALPHA (A sub d / k sub A , ~A sub d / k sub A , ~A sub d / k sub A , ~A sub d / k sub A ) GL.GL_ONE_MINUS_DST_ALPHA (1, ~1, ~1, ~1 ) ~-~ (A sub d / k sub A , ~A sub d / k sub A , ~A sub d / k sub A , ~A sub d / k sub A ) GL.GL_SRC_ALPHA_SATURATE (i, ~i, ~i, ~1 ) .TE .sp In the table,

.RS .nf

i ~=~ min (A sub s , ~k sub A - A sub d ) ~/~ k sub A .fi .RE

To determine the blended RGBA values of a pixel when drawing in RGBA mode, the system uses the following equations:

.RS .nf

R sub d ~=~ min ( k sub R , ~~ R sub s s sub R + R sub d d sub R ) G sub d ~=~ min ( k sub G , ~~ G sub s s sub G + G sub d d sub G ) B sub d ~=~ min ( k sub B , ~~ B sub s s sub B + B sub d d sub B ) A sub d ~=~ min ( k sub A , ~~ A sub s s sub A + A sub d d sub A ) .fi .RE

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 1 is guaranteed not to modify its multiplicand, and a blend factor equal to 0 reduces its multiplicand to 0. For example, when sfactor is GL.GL_SRC_ALPHA, dfactor is GL.GL_ONE_MINUS_SRC_ALPHA, and A sub s is equal to k sub A, the equations reduce to simple replacement:

.RS .nf

R sub d ~=~ R sub s G sub d ~=~ G sub s B sub d ~=~ B sub s A sub d ~=~ A sub s .fi .RE

Parameter sfactor

Specifies how the red, green, blue, and alpha source blending factors are computed. Nine symbolic constants are accepted: GL.GL_ZERO, GL.GL_ONE, GL.GL_DST_COLOR, GL.GL_ONE_MINUS_DST_COLOR, GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA, GL.GL_DST_ALPHA, GL.GL_ONE_MINUS_DST_ALPHA, and GL.GL_SRC_ALPHA_SATURATE. The initial value is GL.GL_ONE.

Parameter dfactor

Specifies how the red, green, blue, and alpha destination blending factors are computed. Eight symbolic constants are accepted: GL.GL_ZERO, GL.GL_ONE, GL.GL_SRC_COLOR, GL.GL_ONE_MINUS_SRC_COLOR, GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA, GL.GL_DST_ALPHA, and GL.GL_ONE_MINUS_DST_ALPHA. The initial value is GL.GL_ZERO.

Throws

GL.GL_INVALID_ENUM is generated if either sfactor or dfactor is not an accepted value.

GL.GL_INVALID_OPERATION is generated if GL.glBlendFunc is executed between the execution of GL.glBegin and the corresponding execution of GL.glEnd.


Method glCallList

void GL.glCallList(int list)

Description

GL.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, GL.glCallList is ignored.

GL.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 GL.glCallList. Thus, changes made to GL state during the execution of a display list remain after execution of the display list is completed. Use GL.glPushAttrib, GL.glPopAttrib, GL.glPushMatrix, and GL.glPopMatrix to preserve GL state across GL.glCallList calls.

Parameter list

Specifies the integer name of the display list to be executed.


Method glClear

void GL.glClear(int mask)

Description

GL.glClear sets the bitplane area of the window to values previously selected by GL.glClearColor, GL.glClearIndex, GL.glClearDepth, GL.glClearStencil, and GL.glClearAccum. Multiple color buffers can be cleared simultaneously by selecting more than one buffer at a time using GL.glDrawBuffer.

The pixel ownership test, the scissor test, dithering, and the buffer writemasks affect the operation of GL.glClear. The scissor box bounds the cleared region. Alpha function, blend function, logical operation, stenciling, texture mapping, and depth-buffering are ignored by GL.glClear.

GL.glClear takes a single argument that is the bitwise OR of several values indicating which buffer is to be cleared.

The values are as follows:

GL.GL_COLOR_BUFFER_BIT Indicates the buffers currently enabled for color writing.
GL.GL_DEPTH_BUFFER_BIT Indicates the depth buffer.
GL.GL_ACCUM_BUFFER_BIT Indicates the accumulation buffer.
GL.GL_STENCIL_BUFFER_BIT Indicates the stencil buffer.

The value to which each buffer is cleared depends on the setting of the clear value for that buffer.

Parameter mask

Bitwise OR of masks that indicate the buffers to be cleared. The four masks are GL.GL_COLOR_BUFFER_BIT, GL.GL_DEPTH_BUFFER_BIT, GL.GL_ACCUM_BUFFER_BIT, and GL.GL_STENCIL_BUFFER_BIT.

Throws

GL.GL_INVALID_VALUE is generated if any bit other than the four defined bits is set in mask.

GL.GL_INVALID_OPERATION is generated if GL.glClear is executed between the execution of GL.glBegin and the corresponding execution of GL.glEnd.


Method glClearAccum

void GL.glClearAccum(float|array(float) red, float|void green, float|void blue, float|void alpha)

Description

GL.glClearAccum specifies the red, green, blue, and alpha values used by GL.glClear to clear the accumulation buffer.

Values specified by GL.glClearAccum are clamped to the range [-1,1].

Parameter red

Specify the red, green, blue, and alpha values used when the accumulation buffer is cleared. The initial values are all 0.

Throws

GL.GL_INVALID_OPERATION is generated if GL.glClearAccum is executed between the execution of GL.glBegin and the corresponding execution of GL.glEnd.


Method glClearColor

void GL.glClearColor(float|array(float) red, float|void green, float|void blue, float|void alpha)

Description

GL.glClearColor specifies the red, green, blue, and alpha values used by GL.glClear to clear the color buffers. Values specified by GL.glClearColor are clamped to the range [0,1].

Parameter red

Specify the red, green, blue, and alpha values used when the color buffers are cleared. The initial values are all 0.

Throws

GL.GL_INVALID_OPERATION is generated if GL.glClearColor is executed between the execution of GL.glBegin and the corresponding execution of GL.glEnd.


Method glClearDepth

void GL.glClearDepth(float depth)

Description

GL.glClearDepth specifies the depth value used by GL.glClear to clear the depth buffer. Values specified by GL.glClearDepth are clamped to the range [0,1].

Parameter depth

Specifies the depth value used when the depth buffer is cleared. The initial value is 1.

Throws

GL.GL_INVALID_OPERATION is generated if GL.glClearDepth is executed between the execution of GL.glBegin and the corresponding execution of GL.glEnd.


Method glClearIndex

void GL.glClearIndex(float c)

Description

GL.glClearIndex specifies the index used by GL.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 2 sup m -1, where m is the number of bits in a color index stored in the frame buffer.

Parameter c

Specifies the index used when the color index buffers are cleared. The initial value is 0.

Throws

GL.GL_INVALID_OPERATION is generated if GL.glClearIndex is executed between the execution of GL.glBegin and the corresponding execution of GL.glEnd.


Method glClearStencil

void GL.glClearStencil(int s)

Description

GL.glClearStencil specifies the index used by GL.glClear to clear the stencil buffer. s is masked with 2 sup m - 1, where m is the number of bits in the stencil buffer.

Parameter s

Specifies the index used when the stencil buffer is cleared. The initial value is 0.

Throws

GL.GL_INVALID_OPERATION is generated if GL.glClearStencil is executed between the execution of GL.glBegin and the corresponding execution of GL.glEnd.


Method glColor

void GL.glColor(float|int red, float|int green, float|int blue, float|int|void alpha)
void GL.glColor(array(float|int) rgb)

Description

The GL stores both a current single-valued color index and a current four-valued RGBA color. If no alpha value has been give, 1.0 (full intensity) is implied.

Current color values are stored in floating-point format, with unspecified mantissa and exponent sizes. Unsigned integer color components, when specified, are linearly mapped to floating-point values such that the largest representable value maps to 1.0 (full intensity), and 0 maps to 0.0 (zero intensity). Signed integer color components, when specified, are linearly mapped to floating-point values such that the most positive representable value maps to 1.0, and the most negative representable value maps to -1.0. (Note that this mapping does not convert 0 precisely to 0.0.) Floating-point values are mapped directly.

Neither floating-point nor signed integer values are clamped to the range [0,1] before the current color is updated. However, color components are clamped to this range before they are interpolated or written into a color buffer.

Parameter red

Specify new red, green, and blue values for the current color.

Parameter alpha

Specifies a new alpha value for the current color.


Method glColorMask

void GL.glColorMask(int red, int green, int blue, int alpha)

Description

GL.glColorMask specifies whether the individual color components in the frame buffer can or cannot be written. If red is GL.GL_FALSE, for example, no change is made to the red component of any pixel in any of the color buffers, 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.

Parameter red

Specify whether red, green, blue, and alpha can or cannot be written into the frame buffer. The initial values are all GL.GL_TRUE, indicating that the color components can be written.

Throws

GL.GL_INVALID_OPERATION is generated if GL.glColorMask is executed between the execution of GL.glBegin and the corresponding execution of GL.glEnd.


Method glColorMaterial

void GL.glColorMaterial(int face, int mode)

Description

GL.glColorMaterial specifies which material parameters track the current color. When GL.GL_COLOR_MATERIAL is enabled, the material parameter or parameters specified by mode, of the material or materials specified by face, track the current color at all times.

To enable and disable GL.GL_COLOR_MATERIAL, call GL.glEnable and GL.glDisable with argument GL.GL_COLOR_MATERIAL. GL.GL_COLOR_MATERIAL is initially disabled.

Parameter face

Specifies whether front, back, or both front and back material parameters should track the current color. Accepted values are GL.GL_FRONT, GL.GL_BACK, and GL.GL_FRONT_AND_BACK. The initial value is GL.GL_FRONT_AND_BACK.

Parameter mode

Specifies which of several material parameters track the current color. Accepted values are GL.GL_EMISSION, GL.GL_AMBIENT, GL.GL_DIFFUSE, GL.GL_SPECULAR, and GL.GL_AMBIENT_AND_DIFFUSE. The initial value is GL.GL_AMBIENT_AND_DIFFUSE.

Throws

GL.GL_INVALID_ENUM is generated if face or mode is not an accepted value.

GL.GL_INVALID_OPERATION is generated if GL.glColorMaterial is executed between the execution of GL.glBegin and the corresponding execution of GL.glEnd.


Method glCopyPixels

void GL.glCopyPixels(int x, int y, int width, int height, int type)

Description

GL.glCopyPixels copies a screen-aligned rectangle of pixels from the specified frame buffer location to a region relative to the current raster position. Its operation is well defined only if the entire pixel source region is within the exposed portion of the window. Results of copies from outside the window, or from regions of the window that are not exposed, are hardware dependent and undefined.

x and y specify the window coordinates of the lower left corner of the rectangular region to be copied. width and height specify the dimensions of the rectangular region to be copied. Both width and height must not be negative.

Several parameters control the processing of the pixel data while it is being copied. These parameters are set with three commands: glPixelTransfer, glPixelMap, and GL.glPixelZoom. This reference page describes the effects on GL.glCopyPixels of most, but not all, of the parameters specified by these three commands.

GL.glCopyPixels copies values from each pixel with the lower left-hand corner at (x + i, y + j) for 0\(<=i<width and 0\(<=j<height. This pixel is said to be the ith pixel in the jth row. Pixels are copied in row order from the lowest to the highest row, left to right in each row.

type specifies whether color, depth, or stencil data is to be copied. The details of the transfer for each data type are as follows:

GL.GL_COLOR Indices or RGBA colors are read from the buffer currently specified as the read source buffer (see GL.glReadBuffer). If the GL is in color index mode, each index that is read from this buffer is converted to a fixed-point format with an unspecified number of bits to the right of the binary point. Each index is then shifted left by GL.GL_INDEX_SHIFT bits, and added to GL.GL_INDEX_OFFSET. If GL.GL_INDEX_SHIFT is negative, the shift is to the right. In either case, zero bits fill otherwise unspecified bit locations in the result. If GL.GL_MAP_COLOR is true, the index is replaced with the value that it references in lookup table GL.GL_PIXEL_MAP_I_TO_I. Whether the lookup replacement of the index is done or not, the integer part of the index is then ANDed with 2 sup b -1, where b is the number of bits in a color index buffer. If the GL is in RGBA mode, the red, green, blue, and alpha components of each pixel that is read are converted to an internal floating-point format with unspecified precision. The conversion maps the largest representable component value to 1.0, and component value 0 to 0.0. The resulting floating-point color values are then multiplied by GL_c_SCALE and added to GL_c_BIAS, where c is RED, GREEN, BLUE, and ALPHA for the respective color components. The results are clamped to the range [0,1]. If GL.GL_MAP_COLOR is true, each color component is scaled by the size of lookup table GL_PIXEL_MAP_c_TO_c, then replaced by the value that it references in that table. c is R, G, B, or A. The GL then converts the resulting indices or RGBA colors to fragments by attaching the current raster position z coordinate and texture coordinates to each pixel, then assigning window coordinates (x sub r + i , y sub r + j), where (x sub r , y sub r) is the current raster position, and the pixel was the ith pixel in the jth row. These pixel fragments are then treated just like the fragments generated by rasterizing points, lines, or polygons. Texture mapping, fog, and all the fragment operations are applied before the fragments are written to the frame buffer.
GL.GL_DEPTH Depth values are read from the depth buffer and converted directly to an internal floating-point format with unspecified precision. The resulting floating-point depth value is then multiplied by GL.GL_DEPTH_SCALE and added to GL.GL_DEPTH_BIAS. The result is clamped to the range [0,1]. The GL then converts the resulting depth components to fragments by attaching the current raster position color or color index and texture coordinates to each pixel, then assigning window coordinates (x sub r + i , y sub r + j), where (x sub r , y sub r) is the current raster position, and the pixel was the ith pixel in the jth row. These pixel fragments are then treated just like the fragments generated by rasterizing points, lines, or polygons. Texture mapping, fog, and all the fragment operations are applied before the fragments are written to the frame buffer.
GL.GL_STENCIL Stencil indices are read from the stencil buffer and converted to an internal fixed-point format with an unspecified number of bits to the right of the binary point. Each fixed-point index is then shifted left by GL.GL_INDEX_SHIFT bits, and added to GL.GL_INDEX_OFFSET. If GL.GL_INDEX_SHIFT is negative, the shift is to the right. In either case, zero bits fill otherwise unspecified bit locations in the result. If GL.GL_MAP_STENCIL is true, the index is replaced with the value that it references in lookup table GL.GL_PIXEL_MAP_S_TO_S. Whether the lookup replacement of the index is done or not, the integer part of the index is then ANDed with 2 sup b -1, where b is the number of bits in the stencil buffer. The resulting stencil indices are then written to the stencil buffer such that the index read from the ith location of the jth row is written to location (x sub r + i , y sub r + j), where (x sub r , y sub r) is the current raster position. Only the pixel ownership test, the scissor test, and the stencil writemask affect these write operations.

The rasterization described thus far assumes pixel zoom factors of 1.0. If

GL.glPixelZoom is used to change the x and y pixel zoom factors, pixels are converted to fragments as follows. If (x sub r, y sub r) is the current raster position, and a given pixel is in the ith location in the jth row of the source pixel rectangle, then fragments are generated for pixels whose centers are in the rectangle with corners at

.ce (x sub r + zoom sub x i, y sub r + zoom sub y j) .sp .5 .ce and .sp .5 .ce (x sub r + zoom sub x (i + 1), y sub r + zoom sub y ( j + 1 ))

where zoom sub x is the value of GL.GL_ZOOM_X and zoom sub y is the value of GL.GL_ZOOM_Y.

Parameter x

Specify the window coordinates of the lower left corner of the rectangular region of pixels to be copied.

Parameter width

Specify the dimensions of the rectangular region of pixels to be copied. Both must be nonnegative.

Parameter type

Specifies whether color values, depth values, or stencil values are to be copied. Symbolic constants GL.GL_COLOR, GL.GL_DEPTH, and GL.GL_STENCIL are accepted.

Throws

GL.GL_INVALID_ENUM is generated if type is not an accepted value.

GL.GL_INVALID_VALUE is generated if either width or height is negative.

GL.GL_INVALID_OPERATION is generated if type is GL.GL_DEPTH and there is no depth buffer.

GL.GL_INVALID_OPERATION is generated if type is GL.GL_STENCIL and there is no stencil buffer.

GL.GL_INVALID_OPERATION is generated if GL.glCopyPixels is executed between the execution of GL.glBegin and the corresponding execution of GL.glEnd.


Method glCopyTexImage1D

void GL.glCopyTexImage1D(int target, int level, int internalFormat, int x, int y, int width, int border)

Description

GL.glCopyTexImage1D defines a one-dimensional texture image with pixels from the current GL.GL_READ_BUFFER.

The screen-aligned pixel row with left corner at ("x", "y") and with a length of "width"~+~2~*~"border" defines the texture array at the mipmap level specified by level. internalFormat specifies the internal format of the texture array.

The pixels in the row are processed exactly as if GL.glCopyPixels had been called, but the process stops just before final conversion. At this point all pixel component values are clamped to the range [0,\ 1] and then converted to the texture's internal format for storage in the texel array.

Pixel ordering is such that lower x screen coordinates correspond to lower texture coordinates.

If any of the pixels within the specified row of the current GL.GL_READ_BUFFER are outside the window associated with the current rendering context, then the values obtained for those pixels are undefined.

Parameter target

Specifies the target texture. Must be GL.GL_TEXTURE_1D.

Parameter level

Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image.

Parameter internalFormat

Specifies the internal format of the texture. Must be one of the following symbolic constants: GL.GL_ALPHA, GL.GL_ALPHA4, GL.GL_ALPHA8, GL.GL_ALPHA12, GL.GL_ALPHA16, GL.GL_LUMINANCE, GL.GL_LUMINANCE4, GL.GL_LUMINANCE8, GL.GL_LUMINANCE12, GL.GL_LUMINANCE16, GL.GL_LUMINANCE_ALPHA, GL.GL_LUMINANCE4_ALPHA4, GL.GL_LUMINANCE6_ALPHA2, GL.GL_LUMINANCE8_ALPHA8, GL.GL_LUMINANCE12_ALPHA4, GL.GL_LUMINANCE12_ALPHA12, GL.GL_LUMINANCE16_ALPHA16, GL.GL_INTENSITY, GL.GL_INTENSITY4, GL.GL_INTENSITY8, GL.GL_INTENSITY12, GL.GL_INTENSITY16, GL.GL_RGB, GL.GL_R3_G3_B2, GL.GL_RGB4, GL.GL_RGB5, GL.GL_RGB8, GL.GL_RGB10, GL.GL_RGB12, GL.GL_RGB16, GL.GL_RGBA, GL.GL_RGBA2, GL.GL_RGBA4, GL.GL_RGB5_A1, GL.GL_RGBA8, GL.GL_RGB10_A2, GL.GL_RGBA12, or GL.GL_RGBA16.

Parameter x

Specify the window coordinates of the left corner of the row of pixels to be copied.

Parameter width

Specifies the width of the texture image. Must be 0 or 2**n ~+~ 2*border for some integer n. The height of the texture image is 1.

Parameter border

Specifies the width of the border. Must be either 0 or 1.

Throws

GL.GL_INVALID_ENUM is generated if target is not one of the allowable values.

GL.GL_INVALID_VALUE is generated if level is less than 0. .P GL.GL_INVALID_VALUE may be generated if level is greater than log sub 2 max, where max is the returned value of GL.GL_MAX_TEXTURE_SIZE. .P GL.GL_INVALID_VALUE is generated if internalFormat is not an allowable value.

GL.GL_INVALID_VALUE is generated if width is less than 0 or greater than 2 + GL.GL_MAX_TEXTURE_SIZE, or if it cannot be represented as 2 ** n ~+~ 2~*~("border") for some integer value of n.

GL.GL_INVALID_VALUE is generated if border is not 0 or 1.

GL.GL_INVALID_OPERATION is generated if GL.glCopyTexImage1D is executed between the execution of GL.glBegin and the corresponding execution of GL.glEnd.


Method glCopyTexImage2D

void GL.glCopyTexImage2D(int target, int level, int internalFormat, int x, int y, int width, int height, int border)

Description

GL.glCopyTexImage2D defines a two-dimensional texture image with pixels from the current GL.GL_READ_BUFFER.

The screen-aligned pixel rectangle with lower left corner at (x, y) and with a width of width~+~2~*~border and a height of height~+~2~*~border defines the texture array at the mipmap level specified by level. internalFormat specifies the internal format of the texture array.

The pixels in the rectangle are processed exactly as if GL.glCopyPixels had been called, but the process stops just before final conversion. At this point all pixel component values are clamped to the range [0,1] and then converted to the texture's internal format for storage in the texel array.

Pixel ordering is such that lower x and y screen coordinates correspond to lower s and t texture coordinates.

If any of the pixels within the specified rectangle of the current GL.GL_READ_BUFFER are outside the window associated with the current rendering context, then the values obtained for those pixels are undefined.

Parameter target

Specifies the target texture. Must be GL.GL_TEXTURE_2D.

Parameter level

Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image.

Parameter internalFormat

Specifies the internal format of the texture. Must be one of the following symbolic constants: GL.GL_ALPHA, GL.GL_ALPHA4, GL.GL_ALPHA8, GL.GL_ALPHA12, GL.GL_ALPHA16, GL.GL_LUMINANCE, GL.GL_LUMINANCE4, GL.GL_LUMINANCE8, GL.GL_LUMINANCE12, GL.GL_LUMINANCE16, GL.GL_LUMINANCE_ALPHA, GL.GL_LUMINANCE4_ALPHA4, GL.GL_LUMINANCE6_ALPHA2, GL.GL_LUMINANCE8_ALPHA8, GL.GL_LUMINANCE12_ALPHA4, GL.GL_LUMINANCE12_ALPHA12, GL.GL_LUMINANCE16_ALPHA16, GL.GL_INTENSITY, GL.GL_INTENSITY4, GL.GL_INTENSITY8, GL.GL_INTENSITY12, GL.GL_INTENSITY16, GL.GL_RGB, GL.GL_R3_G3_B2, GL.GL_RGB4, GL.GL_RGB5, GL.GL_RGB8, GL.GL_RGB10, GL.GL_RGB12, GL.GL_RGB16, GL.GL_RGBA, GL.GL_RGBA2, GL.GL_RGBA4, GL.GL_RGB5_A1, GL.GL_RGBA8, GL.GL_RGB10_A2, GL.GL_RGBA12, or GL.GL_RGBA16.

Parameter x

Specify the window coordinates of the lower left corner of the rectangular region of pixels to be copied.

Parameter width

Specifies the width of the texture image. Must be 0 or 2**n ~+~ 2*border for some integer n.

Parameter height

Specifies the height of the texture image. Must be 0 or 2**m ~+~ 2*border for some integer m.

Parameter border

Specifies the width of the border. Must be either 0 or 1.

Throws

GL.GL_INVALID_ENUM is generated if target is not GL.GL_TEXTURE_2D.

GL.GL_INVALID_VALUE is generated if level is less than 0. .P GL.GL_INVALID_VALUE may be generated if level is greater than log sub 2 max, where max is the returned value of GL.GL_MAX_TEXTURE_SIZE.

GL.GL_INVALID_VALUE is generated if width or height is less than 0, greater than 2~+~GL.GL_MAX_TEXTURE_SIZE, or if width or height cannot be represented as 2**k ~+~ 2~*~border for some integer k.

GL.GL_INVALID_VALUE is generated if border is not 0 or 1.

GL.GL_INVALID_VALUE is generated if internalFormat is not one of the allowable values.

GL.GL_INVALID_OPERATION is generated if GL.glCopyTexImage2D is executed between the execution of GL.glBegin and the corresponding execution of GL.glEnd.


Method glCopyTexSubImage1D

void GL.glCopyTexSubImage1D(int target, int level, int xoffset, int x, int y, int width)

Description

GL.glCopyTexSubImage1D replaces a portion of a one-dimensional texture image with pixels from the current GL.GL_READ_BUFFER (rather than from main memory, as is the case for glTexSubImage1D).

The screen-aligned pixel row with left corner at (x,\ y), and with length width replaces the portion of the texture array with x indices xoffset through "xoffset" ~+~ "width" ~-~ 1, inclusive. The destination in the texture array may not include any texels outside the texture array as it was originally specified.

The pixels in the row are processed exactly as if GL.glCopyPixels had been called, but the process stops just before final conversion. At this point all pixel component values are clamped to the range [0,\ 1] and then converted to the texture's internal format for storage in the texel array.

It is not an error to specify a subtexture with zero width, but such a specification has no effect. If any of the pixels within the specified row of the current GL.GL_READ_BUFFER are outside the read window associated with the current rendering context, then the values obtained for those pixels are undefined.

No change is made to the internalformat, width, or border parameters of the specified texture array or to texel values outside the specified subregion.

Parameter target

Specifies the target texture. Must be GL.GL_TEXTURE_1D.

Parameter level

Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image.

Parameter xoffset

Specifies the texel offset within the texture array.

Parameter x

Specify the window coordinates of the left corner of the row of pixels to be copied.

Parameter width

Specifies the width of the texture subimage.

Throws

GL.GL_INVALID_ENUM is generated if target is not GL.GL_TEXTURE_1D.

GL.GL_INVALID_OPERATION is generated if the texture array has not been defined by a previous glTexImage1D or GL.glCopyTexImage1D operation.

GL.GL_INVALID_VALUE is generated if level is less than 0. .P GL.GL_INVALID_VALUE may be generated if level>log sub 2 max, where max is the returned value of GL.GL_MAX_TEXTURE_SIZE.

GL.GL_INVALID_VALUE is generated if y ~<~ ~-b or if width ~<~ ~-b, where b is the border width of the texture array.

GL.GL_INVALID_VALUE is generated if "xoffset" ~<~ ~-b, or ("xoffset"~+~"width") ~>~ (w-b), where w is the GL.GL_TEXTURE_WIDTH, and b is the GL.GL_TEXTURE_BORDER of the texture image being modified. Note that w includes twice the border width.


Method glCopyTexSubImage2D

void GL.glCopyTexSubImage2D(int target, int level, int xoffset, int yoffset, int x, int y, int width, int height)

Description

GL.glCopyTexSubImage2D replaces a rectangular portion of a two-dimensional texture image with pixels from the current GL.GL_READ_BUFFER (rather than from main memory, as is the case for GL.glTexSubImage2D).

The screen-aligned pixel rectangle with lower left corner at (x,\ y) and with width width and height height replaces the portion of the texture array with x indices xoffset through xoffset~+~width~-~1, inclusive, and y indices yoffset through yoffset~+~height~-~1, inclusive, at the mipmap level specified by level.

The pixels in the rectangle are processed exactly as if GL.glCopyPixels had been called, but the process stops just before final conversion. At this point, all pixel component values are clamped to the range [0,\ 1] and then converted to the texture's internal format for storage in the texel array.

The destination rectangle in the texture array may not include any texels outside the texture array as it was originally specified. It is not an error to specify a subtexture with zero width or height, but such a specification has no effect.

If any of the pixels within the specified rectangle of the current GL.GL_READ_BUFFER are outside the read window associated with the current rendering context, then the values obtained for those pixels are undefined.

No change is made to the internalformat, width, height, or border parameters of the specified texture array or to texel values outside the specified subregion.

Parameter target

Specifies the target texture. Must be GL.GL_TEXTURE_2D

Parameter level

Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image.

Parameter xoffset

Specifies a texel offset in the x direction within the texture array.

Parameter yoffset

Specifies a texel offset in the y direction within the texture array.

Parameter x

Specify the window coordinates of the lower left corner of the rectangular region of pixels to be copied.

Parameter width

Specifies the width of the texture subimage.

Parameter height

Specifies the height of the texture subimage.

Throws

GL.GL_INVALID_ENUM is generated if target is not GL.GL_TEXTURE_2D.

GL.GL_INVALID_OPERATION is generated if the texture array has not been defined by a previous GL.glTexImage2D or GL.glCopyTexImage2D operation.

GL.GL_INVALID_VALUE is generated if level is less than 0. .P GL.GL_INVALID_VALUE may be generated if level is greater than log sub 2 max, where max is the returned value of GL.GL_MAX_TEXTURE_SIZE.

GL.GL_INVALID_VALUE is generated if x ~<~ ~-b or if y ~<~ ~-b, where b is the border width of the texture array.

GL.GL_INVALID_VALUE is generated if "xoffset" ~<~ -b, (xoffset~+~width)~>~(w ~-~b), yoffset~<~ ~-b, or (yoffset~+~height)~>~(h ~-~b), where w is the GL.GL_TEXTURE_WIDTH, h is the GL.GL_TEXTURE_HEIGHT, and b is the GL.GL_TEXTURE_BORDER of the texture image being modified. Note that w and h include twice the border width.

GL.GL_INVALID_OPERATION is generated if GL.glCopyTexSubImage2D is executed between the execution of GL.glBegin and the corresponding execution of GL.glEnd.


Method glDeleteLists

void GL.glDeleteLists(int list, int range)

Description

GL.glDeleteLists causes a contiguous group of display lists to be deleted. list is the name of the first display list to be deleted, and range is the number of display lists to delete. All display lists \fId\fP with list \(<= \fId\fP \(<= list + range - 1 are deleted.

All storage locations allocated to the specified display lists are freed, and the names are available for reuse at a later time. Names within the range that do not have an associated display list are ignored. If range is 0, nothing happens.

Parameter list

Specifies the integer name of the first display list to delete.

Parameter range

Specifies the number of display lists to delete.

Throws

GL.GL_INVALID_VALUE is generated if range is negative.

GL.GL_INVALID_OPERATION is generated if GL.glDeleteLists is executed between the execution of GL.glBegin and the corresponding execution of GL.glEnd.


Method glDepthMask

void GL.glDepthMask(int flag)

Description

GL.glDepthMask specifies whether the depth buffer is enabled for writing. If flag is GL.GL_FALSE, depth buffer writing is disabled. Otherwise, it is enabled. Initially, depth buffer writing is enabled.

Parameter flag

Specifies whether the depth buffer is enabled for writing. If flag is GL.GL_FALSE, depth buffer writing is disabled. Otherwise, it is enabled. Initially, depth buffer writing is enabled.

Throws

GL.GL_INVALID_OPERATION is generated if GL.glDepthMask is executed between the execution of GL.glBegin and the corresponding execution of GL.glEnd.


Method glDepthRange

void GL.glDepthRange(float zNear, float zFar)

Description

After clipping and division by w, depth coordinates range from -1 to 1, corresponding to the near and far clipping planes. GL.glDepthRange specifies a linear mapping of the normalized depth coordinates in this range to window depth coordinates. Regardless of the actual depth buffer implementation, window coordinate depth values are treated as though they range from 0 through 1 (like color components). Thus, the values accepted by GL.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.

Parameter zNear

Specifies the mapping of the near clipping plane to window coordinates. The initial value is 0.

Parameter zFar

Specifies the mapping of the far clipping plane to window coordinates. The initial value is 1.

Throws

GL.GL_INVALID_OPERATION is generated if GL.glDepthRange is executed between the execution of GL.glBegin and the corresponding execution of GL.glEnd.


Method glDrawArrays

void GL.glDrawArrays(int mode, int first, int count)

Description

GL.glDrawArrays specifies multiple geometric primitives with very few subroutine calls. Instead of calling a GL procedure to pass each individual vertex, normal, texture coordinate, edge flag, or color, you can prespecify separate arrays of vertexes, normals, and colors and use them to construct a sequence of primitives with a single call to GL.glDrawArrays.

When GL.glDrawArrays is called, it uses count sequential elements from each enabled array to construct a sequence of geometric primitives, beginning with element first. mode specifies what kind of primitives are constructed, and how the array elements construct those primitives. If GL.GL_VERTEX_ARRAY is not enabled, no geometric primitives are generated.

Vertex attributes that are modified by GL.glDrawArrays have an unspecified value after GL.glDrawArrays returns. For example, if GL.GL_COLOR_ARRAY is enabled, the value of the current color is undefined after GL.glDrawArrays executes. Attributes that aren't modified remain well defined.

Parameter mode

Specifies what kind of primitives to render. Symbolic constants GL.GL_POINTS, GL.GL_LINE_STRIP, GL.GL_LINE_LOOP, GL.GL_LINES, GL.GL_TRIANGLE_STRIP, GL.GL_TRIANGLE_FAN, GL.GL_TRIANGLES, GL.GL_QUAD_STRIP, GL.GL_QUADS, and GL.GL_POLYGON are accepted.

Parameter first

Specifies the starting index in the enabled arrays.

Parameter count

Specifies the number of indices to be rendered.

Throws

GL.GL_INVALID_ENUM is generated if mode is not an accepted value.

GL.GL_INVALID_VALUE is generated if count is negative.

GL.GL_INVALID_OPERATION is generated if GL.glDrawArrays is executed between the execution of GL.glBegin and the corresponding GL.glEnd.


Method glDrawPixels

void GL.glDrawPixels(object|mapping(string:object) width, object|mapping(string:object) height, object|mapping(string:object) format, object|mapping(string:object) type, array(object|mapping(string:object)) pixels)

Description

GL.glDrawPixels reads pixel data from memory and writes it into the frame buffer relative to the current raster position. Use GL.glRasterPos to set the current raster position; use glGet with argument GL.GL_CURRENT_RASTER_POSITION to query the raster position.

Several parameters define the encoding of pixel data in memory and control the processing of the pixel data before it is placed in the frame buffer. These parameters are set with four commands: glPixelStore, glPixelTransfer, glPixelMap, and GL.glPixelZoom. This reference page describes the effects on GL.glDrawPixels of many, but not all, of the parameters specified by these four commands.

Data is read from pixels as a sequence of signed or unsigned bytes, signed or unsigned shorts, signed or unsigned integers, or single-precision floating-point values, depending on type. Each of these bytes, shorts, integers, or floating-point values is interpreted as one color or depth component, or one index, depending on format. Indices are always treated individually. Color components are treated as groups of one, two, three, or four values, again based on format. Both individual indices and groups of components are referred to as pixels. If type is GL.GL_BITMAP, the data must be unsigned bytes, and format must be either GL.GL_COLOR_INDEX or GL.GL_STENCIL_INDEX. Each unsigned byte is treated as eight 1-bit pixels, with bit ordering determined by GL.GL_UNPACK_LSB_FIRST (see glPixelStore).

widthtimesheight pixels are read from memory, starting at location pixels. By default, these pixels are taken from adjacent memory locations, except that after all width pixels are read, the read pointer is advanced to the next four-byte boundary. The four-byte row alignment is specified by glPixelStore with argument GL.GL_UNPACK_ALIGNMENT, and it can be set to one, two, four, or eight bytes. Other pixel store parameters specify different read pointer advancements, both before the first pixel is read and after all width pixels are read. See the

glPixelStore reference page for details on these options.

The widthtimesheight pixels that are read from memory are each operated on in the same way, based on the values of several parameters specified by glPixelTransfer and glPixelMap. The details of these operations, as well as the target buffer into which the pixels are drawn, are specific to the format of the pixels, as specified by format. format can assume one of eleven symbolic values:

GL.GL_COLOR_INDEX Each pixel is a single value, a color index. It is converted to fixed-point format, with an unspecified number of bits to the right of the binary point, regardless of the memory data type. Floating-point values convert to true fixed-point values. Signed and unsigned integer data is converted with all fraction bits set to 0. Bitmap data convert to either 0 or 1. Each fixed-point index is then shifted left by GL.GL_INDEX_SHIFT bits and added to GL.GL_INDEX_OFFSET. If GL.GL_INDEX_SHIFT is negative, the shift is to the right. In either case, zero bits fill otherwise unspecified bit locations in the result. If the GL is in RGBA mode, the resulting index is converted to an RGBA pixel with the help of the GL.GL_PIXEL_MAP_I_TO_R, GL.GL_PIXEL_MAP_I_TO_G, GL.GL_PIXEL_MAP_I_TO_B, and GL.GL_PIXEL_MAP_I_TO_A tables. If the GL is in color index mode, and if GL.GL_MAP_COLOR is true, the index is replaced with the value that it references in lookup table GL.GL_PIXEL_MAP_I_TO_I. Whether the lookup replacement of the index is done or not, the integer part of the index is then ANDed with 2 sup b -1, where b is the number of bits in a color index buffer. The GL then converts the resulting indices or RGBA colors to fragments by attaching the current raster position z coordinate and texture coordinates to each pixel, then assigning x and y window coordinates to the nth fragment such that .sp .RS .ce x sub n ~=~ x sub r ~+~ n ~ roman mod ~ "width" .sp .ce y sub n ~=~ y sub r ~+~ \(lf ~ n / "width" ~ \(rf .ce 0 .sp .RE where (x sub r , y sub r) is the current raster position. These pixel fragments are then treated just like the fragments generated by rasterizing points, lines, or polygons. Texture mapping, fog, and all the fragment operations are applied before the fragments are written to the frame buffer.
GL.GL_STENCIL_INDEX Each pixel is a single value, a stencil index. It is converted to fixed-point format, with an unspecified number of bits to the right of the binary point, regardless of the memory data type. Floating-point values convert to true fixed-point values. Signed and unsigned integer data is converted with all fraction bits set to 0. Bitmap data convert to either 0 or 1. Each fixed-point index is then shifted left by GL.GL_INDEX_SHIFT bits, and added to GL.GL_INDEX_OFFSET. If GL.GL_INDEX_SHIFT is negative, the shift is to the right. In either case, zero bits fill otherwise unspecified bit locations in the result. If GL.GL_MAP_STENCIL is true, the index is replaced with the value that it references in lookup table GL.GL_PIXEL_MAP_S_TO_S. Whether the lookup replacement of the index is done or not, the integer part of the index is then ANDed with 2 sup b -1, where b is the number of bits in the stencil buffer. The resulting stencil indices are then written to the stencil buffer such that the nth index is written to location

.RS .ce x sub n ~=~ x sub r ~+~ n ~ roman mod ~ "width" .sp .ce y sub n ~=~ y sub r ~+~ \(lf ~ n / "width" ~ \(rf .fi .sp .RE

where (x sub r , y sub r) is the current raster position. Only the pixel ownership test, the scissor test, and the stencil writemask affect these write operations.

GL.GL_DEPTH_COMPONENT Each pixel is a single-depth component. Floating-point data is converted directly to an internal floating-point format with unspecified precision. Signed integer data is mapped linearly to the internal floating-point format such that the most positive representable integer value maps to 1.0, and the most negative representable value maps to -1.0. Unsigned integer data is mapped similarly: the largest integer value maps to 1.0, and 0 maps to 0.0. The resulting floating-point depth value is then multiplied by by GL.GL_DEPTH_SCALE and added to GL.GL_DEPTH_BIAS. The result is clamped to the range [0,1]. The GL then converts the resulting depth components to fragments by attaching the current raster position color or color index and texture coordinates to each pixel, then assigning x and y window coordinates to the nth fragment such that

.RS .ce x sub n ~=~ x sub r ~+~ n ~ roman mod ~ "width" .sp .ce y sub n ~=~ y sub r ~+~ \(lf ~ n / "width" ~ \(rf .ce 0 .sp .RE

where (x sub r , y sub r) is the current raster position. These pixel fragments are then treated just like the fragments generated by rasterizing points, lines, or polygons. Texture mapping, fog, and all the fragment operations are applied before the fragments are written to the frame buffer.

GL.GL_RGBA Each pixel is a four-component group: for GL.GL_RGBA, the red component is first, followed by green, followed by blue, followed by alpha. Floating-point values are converted directly to an internal floating-point format with unspecified precision. Signed integer values are mapped linearly to the internal floating-point format such that the most positive representable integer value maps to 1.0, and the most negative representable value maps to -1.0. (Note that this mapping does not convert 0 precisely to 0.0.) Unsigned integer data is mapped similarly: the largest integer value maps to 1.0, and 0 maps to 0.0. The resulting floating-point color values are then multiplied by GL_c_SCALE and added to GL_c_BIAS, where c is RED, GREEN, BLUE, and ALPHA for the respective color components. The results are clamped to the range [0,1]. If GL.GL_MAP_COLOR is true, each color component is scaled by the size of lookup table GL_PIXEL_MAP_c_TO_c, then replaced by the value that it references in that table. c is R, G, B, or A respectively. The GL then converts the resulting RGBA colors to fragments by attaching the current raster position z coordinate and texture coordinates to each pixel, then assigning x and y window coordinates to the nth fragment such that

.RS .ce x sub n ~=~ x sub r ~+~ n ~ roman mod ~ "width" .sp .ce y sub n ~=~ y sub r ~+~ \(lf ~ n / "width" ~ \(rf .ce 0 .sp .RE

where (x sub r , y sub r) is the current raster position. These pixel fragments are then treated just like the fragments generated by rasterizing points, lines, or polygons. Texture mapping, fog, and all the fragment operations are applied before the fragments are written to the frame buffer.

GL.GL_RED Each pixel is a single red component. This component is converted to the internal floating-point format in the same way the red component of an RGBA pixel is. It is then converted to an RGBA pixel with green and blue set to 0, and alpha set to 1. After this conversion, the pixel is treated as if it had been read as an RGBA pixel.
GL.GL_GREEN Each pixel is a single green component. This component is converted to the internal floating-point format in the same way the green component of an RGBA pixel is. It is then converted to an RGBA pixel with red and blue set to 0, and alpha set to 1. After this conversion, the pixel is treated as if it had been read as an RGBA pixel.
GL.GL_BLUE Each pixel is a single blue component. This component is converted to the internal floating-point format in the same way the blue component of an RGBA pixel is. It is then converted to an RGBA pixel with red and green set to 0, and alpha set to 1. After this conversion, the pixel is treated as if it had been read as an RGBA pixel.
GL.GL_ALPHA Each pixel is a single alpha component. This component is converted to the internal floating-point format in the same way the alpha component of an RGBA pixel is. It is then converted to an RGBA pixel with red, green, and blue set to 0. After this conversion, the pixel is treated as if it had been read as an RGBA pixel.
GL.GL_RGB Each pixel is a three-component group: red first, followed by green, followed by blue. Each component is converted to the internal floating-point format in the same way the red, green, and blue components of an RGBA pixel are. The color triple is converted to an RGBA pixel with alpha set to 1. After this conversion, the pixel is treated as if it had been read as an RGBA pixel.
GL.GL_LUMINANCE Each pixel is a single luminance component. This component is converted to the internal floating-point format in the same way the red component of an RGBA pixel is. It is then converted to an RGBA pixel with red, green, and blue set to the converted luminance value, and alpha set to 1. After this conversion, the pixel is treated as if it had been read as an RGBA pixel.
GL.GL_LUMINANCE_ALPHA Each pixel is a two-component group: luminance first, followed by alpha. The two components are converted to the internal floating-point format in the same way the red component of an RGBA pixel is. They are then converted to an RGBA pixel with red, green, and blue set to the converted luminance value, and alpha set to the converted alpha value. After this conversion, the pixel is treated as if it had been read as an RGBA pixel.

The following table summarizes the meaning of the valid constants for the type parameter: .sp 2 .TS center box ; ci | ci c | c . type corresponding type = GL_UNSIGNED_BYTE unsigned 8-bit integer GL_BYTE signed 8-bit integer GL_BITMAP single bits in unsigned 8-bit integers GL_UNSIGNED_SHORT unsigned 16-bit integer GL_SHORT signed 16-bit integer GL_UNSIGNED_INT unsigned 32-bit integer GL_INT 32-bit integer GL_FLOAT single-precision floating-point .TE .sp

The rasterization described so far assumes pixel zoom factors of 1. If

GL.glPixelZoom is used to change the x and y pixel zoom factors, pixels are converted to fragments as follows. If (x sub r, y sub r) is the current raster position, and a given pixel is in the nth column and mth row of the pixel rectangle, then fragments are generated for pixels whose centers are in the rectangle with corners at .sp .RS .ce (x sub r + zoom sub x n, y sub r + zoom sub y m) .sp .ce (x sub r + zoom sub x (n + 1), y sub r + zoom sub y ( m + 1 )) .ce 0 .sp .RE

where zoom sub x is the value of GL.GL_ZOOM_X and zoom sub y is the value of GL.GL_ZOOM_Y.

Parameter width

Specify the dimensions of the pixel rectangle to be written into the frame buffer.

Parameter format

Specifies the format of the pixel data. Symbolic constants GL.GL_COLOR_INDEX, GL.GL_STENCIL_INDEX, GL.GL_DEPTH_COMPONENT, GL.GL_RGBA, GL.GL_RED, GL.GL_GREEN, GL.GL_BLUE, GL.GL_ALPHA, GL.GL_RGB, GL.GL_LUMINANCE, and GL.GL_LUMINANCE_ALPHA are accepted.

Parameter type

Specifies the data type for pixels. Symbolic constants GL.GL_UNSIGNED_BYTE, GL.GL_BYTE, GL.GL_BITMAP, GL.GL_UNSIGNED_SHORT, GL.GL_SHORT, GL.GL_UNSIGNED_INT, GL.GL_INT, and GL.GL_FLOAT are accepted.

Parameter pixels

Specifies a pointer to the pixel data.

Throws

GL.GL_INVALID_VALUE is generated if either width or height is negative.

GL.GL_INVALID_ENUM is generated if format or type is not one of the accepted values.

GL.GL_INVALID_OPERATION is generated if format is GL.GL_RED, GL.GL_GREEN, GL.GL_BLUE, GL.GL_ALPHA, GL.GL_RGB, GL.GL_RGBA, GL.GL_LUMINANCE, or GL.GL_LUMINANCE_ALPHA, and the GL is in color index mode.

GL.GL_INVALID_ENUM is generated if type is GL.GL_BITMAP and format is not either GL.GL_COLOR_INDEX or GL.GL_STENCIL_INDEX.

GL.GL_INVALID_OPERATION is generated if format is GL.GL_STENCIL_INDEX and there is no stencil buffer.

GL.GL_INVALID_OPERATION is generated if GL.glDrawPixels is executed between the execution of GL.glBegin and the corresponding execution of GL.glEnd.


Method glEdgeFlag

void GL.glEdgeFlag(int flag)

Description

Each vertex of a polygon, separate triangle, or separate quadrilateral specified between a GL.glBegin/GL.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. GL.glEdgeFlag sets the edge flag bit to GL.GL_TRUE if flag is GL.GL_TRUE, and to GL.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.GL_POLYGON_MODE is set to GL.GL_POINT or GL.GL_LINE. See GL.glPolygonMode.

Parameter flag

Specifies the current edge flag value, either GL.GL_TRUE or GL.GL_FALSE. The initial value is GL.GL_TRUE.

Parameter flag

Specifies a pointer to an array that contains a single boolean element, which replaces the current edge flag value.


Method glEvalCoord

void GL.glEvalCoord(float|int|array(float|int) u, float|int|void v)

Description

GL.glEvalCoord evaluates enabled one-dimensional maps at argument u or two-dimensional maps using two domain values, u and v. To define a map, call glMap1 and glMap2; to enable and disable it, call GL.glEnable and GL.glDisable.

When one of the GL.glEvalCoord commands is issued, all currently enabled maps of the indicated dimension are evaluated. Then, for each enabled map, it is as if the corresponding GL command had been issued with the computed value. That is, if GL.GL_MAP1_INDEX or GL.GL_MAP2_INDEX is enabled, a GL.glIndex command is simulated. If GL.GL_MAP1_COLOR_4 or GL.GL_MAP2_COLOR_4 is enabled, a GL.glColor command is simulated. If GL.GL_MAP1_NORMAL or GL.GL_MAP2_NORMAL is enabled, a normal vector is produced, and if any of GL.GL_MAP1_TEXTURE_COORD_1, GL.GL_MAP1_TEXTURE_COORD_2, GL.GL_MAP1_TEXTURE_COORD_3, GL.GL_MAP1_TEXTURE_COORD_4, GL.GL_MAP2_TEXTURE_COORD_1, GL.GL_MAP2_TEXTURE_COORD_2, GL.GL_MAP2_TEXTURE_COORD_3, or GL.GL_MAP2_TEXTURE_COORD_4 is enabled, then an appropriate GL.glTexCoord command is simulated.

For color, color index, normal, and texture coordinates the GL uses evaluated values instead of current values for those evaluations that are enabled, and current values otherwise, However, the evaluated values do not update the current values. Thus, if GL.glVertex commands are interspersed with GL.glEvalCoord commands, the color, normal, and texture coordinates associated with the GL.glVertex commands are not affected by the values generated by the GL.glEvalCoord commands, but only by the most recent GL.glColor, GL.glIndex, GL.glNormal, and GL.glTexCoord commands.

No commands are issued for maps that are not enabled. If more than one texture evaluation is enabled for a particular dimension (for example, GL.GL_MAP2_TEXTURE_COORD_1 and GL.GL_MAP2_TEXTURE_COORD_2), then only the evaluation of the map that produces the larger number of coordinates (in this case, GL.GL_MAP2_TEXTURE_COORD_2) is carried out. GL.GL_MAP1_VERTEX_4 overrides GL.GL_MAP1_VERTEX_3, and GL.GL_MAP2_VERTEX_4 overrides GL.GL_MAP2_VERTEX_3, in the same manner. If neither a three- nor a four-component vertex map is enabled for the specified dimension, the GL.glEvalCoord command is ignored.

If you have enabled automatic normal generation, by calling GL.glEnable with argument GL.GL_AUTO_NORMAL, GL.glEvalCoord generates surface normals analytically, regardless of the contents or enabling of the GL.GL_MAP2_NORMAL map. Let .sp .nf Pp Pp m = -- X -- Pu Pv .sp .fi

Then the generated normal n is

n = m over ~ over { || m || }

.sp

If automatic normal generation is disabled, the corresponding normal map GL.GL_MAP2_NORMAL, if enabled, is used to produce a normal. If neither automatic normal generation nor a normal map is enabled, no normal is generated for GL.glEvalCoord commands.

Parameter u

Specifies a value that is the domain coordinate u to the basis function defined in a previous glMap1 or glMap2 command.

Parameter v

Specifies a value that is the domain coordinate v to the basis function defined in a previous glMap2 command.

Parameter u

Specifies a pointer to an array containing either one or two domain coordinates. The first coordinate is u. The second coordinate is v.


Method glEvalPoint

void GL.glEvalPoint(int|array(int) i, int|void j)

Description

glMapGrid and glEvalMesh are used in tandem to efficiently generate and evaluate a series of evenly spaced map domain values. GL.glEvalPoint can be used to evaluate a single grid point in the same gridspace that is traversed by glEvalMesh. Calling GL.glEvalPoint is equivalent to calling .nf

glEvalCoord1(i . DELTA u + u ); 1 where

DELTA u = (u - u ) / n 2 1

and n, u , and u 1 2

.fi are the arguments to the most recent glMapGrid1 command. The one absolute numeric requirement is that if i~=~n, then the value computed from .nf i . DELTA u + u is exactly u . 1 2

.fi

In the two-dimensional case, GL.glEvalPoint, let .nf DELTA u = (u - u )/n 2 1

DELTA v = (v - v )/m 2 1

where n, u , u , m, v , and v 1 2 1 2

.fi are the arguments to the most recent glMapGrid2 command. Then the GL.glEvalPoint command is equivalent to calling .nf

glEvalCoord2(i . DELTA u + u , j . DELTA v + v ); 1 1

.fi The only absolute numeric requirements are that if i~=~n, then the value computed from .nf

i . DELTA u + u is exactly u , 1 2 .fi and if j~=~m, then the value computed from .nf

j cdot DELTA v + v is exactly v . 1 2

Parameter i

Specifies the integer value for grid domain variable i.

Parameter j

Specifies the integer value for grid domain variable j (GL.glEvalPoint only).


Method glFog

void GL.glFog(int pname, float|int|array(float|int) param)

Description

Fog is initially disabled. While enabled, fog affects rasterized geometry, bitmaps, and pixel blocks, but not buffer clear operations. To enable and disable fog, call GL.glEnable and GL.glDisable with argument GL.GL_FOG.

GL.glFog assigns the value or values in params to the fog parameter specified by pname. The following values are accepted for pname:

GL.GL_FOG_MODE params is a single integer or floating-point value that specifies the equation to be used to compute the fog blend factor, f. Three symbolic constants are accepted: GL.GL_LINEAR, GL.GL_EXP, and GL.GL_EXP2. The equations corresponding to these symbolic constants are defined below. The initial fog mode is GL.GL_EXP.
GL.GL_FOG_DENSITY params is a single integer or floating-point value that specifies density, the fog density used in both exponential fog equations. Only nonnegative densities are accepted. The initial fog density is 1.
GL.GL_FOG_START params is a single integer or floating-point value that specifies start, the near distance used in the linear fog equation. The initial near distance is 0.
GL.GL_FOG_END params is a single integer or floating-point value that specifies end, the far distance used in the linear fog equation. The initial far distance is 1.
GL.GL_FOG_INDEX params is a single integer or floating-point value that specifies i sub f, the fog color index. The initial fog index is 0.
GL.GL_FOG_COLOR params contains four integer or floating-point values that specify C sub f, the fog color. Integer values are mapped linearly such that the most positive representable value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point values are mapped directly. After conversion, all color components are clamped to the range [0,1]. The initial fog color is (0, 0, 0, 0).

Fog blends a fog color with each rasterized pixel fragment's posttexturing color using a blending factor f. Factor f is computed in one of three ways, depending on the fog mode. Let z be the distance in eye coordinates from the origin to the fragment being fogged. The equation for GL.GL_LINEAR fog is .ce

.EQ f ~=~ {end ~-~ z} over {end ~-~ start} .EN

.RE

The equation for GL.GL_EXP fog is .ce

.EQ f ~=~ e ** (-(density ~cdot~ z)) .EN

The equation for GL.GL_EXP2 fog is .ce

.EQ f ~=~ e ** (-(density ~cdot~ z) ** 2) .EN

Regardless of the fog mode, f is clamped to the range [0,1] after it is computed. Then, if the GL is in RGBA color mode, the fragment's color C sub r is replaced by .sp .ce .EQ {C sub r} prime ~=~ f C sub r + (1 - f) C sub f .EN

In color index mode, the fragment's color index i sub r is replaced by .sp .ce .EQ {i sub r} prime ~=~ i sub r + (1 - f) i sub f .EN

Parameter pname

Specifies a single-valued fog parameter. GL.GL_FOG_MODE, GL.GL_FOG_DENSITY, GL.GL_FOG_START, GL.GL_FOG_END, and GL.GL_FOG_INDEX are accepted.

Parameter param

Specifies the value that pname will be set to.

Parameter pname

Specifies a fog parameter. GL.GL_FOG_MODE, GL.GL_FOG_DENSITY, GL.GL_FOG_START, GL.GL_FOG_END, GL.GL_FOG_INDEX, and GL.GL_FOG_COLOR are accepted.

Parameter params

Specifies the value or values to be assigned to pname. GL.GL_FOG_COLOR requires an array of four values. All other parameters accept an array containing only a single value.

Throws

GL.GL_INVALID_ENUM is generated if pname is not an accepted value, or if pname is GL.GL_FOG_MODE and params is not an accepted value.

GL.GL_INVALID_VALUE is generated if pname is GL.GL_FOG_DENSITY, and params is negative.

GL.GL_INVALID_OPERATION is generated if GL.glFog is executed between the execution of GL.glBegin and the corresponding execution of GL.glEnd.


Method glFrustum

void GL.glFrustum(float left, float right, float bottom, float top, float zNear, float zFar)

Description

GL.glFrustum describes a perspective matrix that produces a perspective projection. The current matrix (see GL.glMatrixMode) is multiplied by this matrix and the result replaces the current matrix, as if GL.glMultMatrix were called with the following matrix as its argument:

.sp 5 .ce .EQ down 130 {left ( ~~ matrix { ccol { {{2 ~ "zNear"} over {"right" - "left"}} above 0 above 0 above 0 } ccol { 0 above {{2 ~ "zNear"} over {"top" - "bottom"}} ~ above 0 above 0 } ccol { A ~~~~ above B ~~~~ above C ~~~~ above -1 ~~~~} ccol { 0 above 0 above D above 0} } ~~~ right )} .EN .sp .ce .EQ down 130 {A ~=~ {"right" + "left"} over {"right" - "left"}} .EN .sp .ce .EQ down 130 {B ~=~ {"top" + "bottom"} over {"top" - "bottom"}} .EN .sp .ce .EQ down 130 {C ~=~ -{{"zFar" + "zNear"} over {"zFar" - "zNear"}}} .EN .sp .ce .EQ down 130 {D ~=~ -{{2 ~ "zFar" ~ "zNear"} over {"zFar" - "zNear"}}} .EN .sp

Typically, the matrix mode is GL.GL_PROJECTION, and (left, bottom, -zNear) and (right, top, -zNear) 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). -zFar specifies the location of the far clipping plane. Both zNear and zFar must be positive.

Use GL.glPushMatrix and GL.glPopMatrix