- operate on the accumulation buffer
C SPECIFICATION
PARAMETERS
_param1 Specifies the accumulation buffer operation.
Symbolic constants GL_ACCUM, GL_LOAD, GL_ADD,
GL_MULT, and GL_RETURN are accepted.
_param2 Specifies a floating-point value used in the
accumulation buffer operation. _param1 deter-
mines how _param2 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 imple-
mentation. 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. 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 pix-
els.
glAccum operates on the accumulation buffer. The first
argument, _param1, is a symbolic constant that selects an
accumulation buffer operation. The second argument,
_param2, 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 applied identically to the
red, green, blue, and alpha components of each pixel. If
a glAccum operation results in a value outside the range
[-1, 1], the contents of an accumulation buffer pixel com-
ponent are undefined.
The operations are as follows:
GL_ACCUM Obtains R, G, B, and A values from the
buffer currently selected for reading (see
rently selected buffer are divided by 2n-1,
multiplied by _param2, and then stored in
the corresponding accumulation buffer cell,
overwriting the current value.
GL_ADD Adds _param2 to each R, G, B, and A in the
accumulation buffer.
GL_MULT Multiplies each R, G, B, and A in the accu-
mulation buffer by _param2 and returns the
scaled component to its corresponding accu-
mulation 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 _param2, then multiplied by
2n-1, clamped to the range [0,2n-1], and
stored in the corresponding display buffer
cell. The only fragment operations that are
applied to this transfer are pixel owner-
ship, scissor, dithering, and color
writemasks.
To clear the accumulation buffer, call glClearAccum with
R, G, B, and A values to set it to, then call glClear with
the accumulation buffer enabled.
NOTES
Only pixels within the current scissor box are updated by
a glAccum operation.
ERRORS
GL_INVALID_ENUM is generated if _param1 is not an accepted
value.
GL_INVALID_OPERATION is generated if there is no accumula-
tion buffer.
GL_INVALID_OPERATION is generated if glAccum is executed
between the execution of glBegin and the corresponding
execution of 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
glClear, glClearAccum, glCopyPixels, glDrawBuffer, glGet,
glReadBuffer, glReadPixels, glScissor, glStencilOp