NAME

glAccum - operate on the accumulation buffer

C SPECIFICATION

void ggllAAccccuumm( GLenum _o_p,
              GLfloat _v_a_l_u_e )

delim $$

PARAMETERS

_o_p
Specifies the accumulation buffer operation. Symbolic constants GGLL__AACCCCUUMM, GGLL__LLOOAADD, GGLL__AADDDD, GGLL__MMUULLTT, and GGLL__RREETTUURRNN are accepted.
_v_a_l_u_e
Specifies a floating-point value used in the accumulation buffer operation. _o_p determines how _v_a_l_u_e 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 ggllGGeettIInntteeggeerrvv four times, with arguments GGLL__AACCCCUUMM__RREEDD__BBIITTSS, GGLL__AACCCCUUMM__GGRREEEENN__BBIITTSS, GGLL__AACCCCUUMM__BBLLUUEE__BBIITTSS, and GGLL__AACCCCUUMM__AALLPPHHAA__BBIITTSS. 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.

ggllAAccccuumm operates on the accumulation buffer. The first argument, _o_p, is a symbolic constant that selects an accumulation buffer operation. The second argument, _v_a_l_u_e, is a floating-point value to be used in that operation. Five operations are specified: GGLL__AACCCCUUMM, GGLL__LLOOAADD, GGLL__AADDDD, GGLL__MMUULLTT, and GGLL__RREETTUURRNN.

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 ggllAAccccuumm 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:

GGLL__AACCCCUUMM
Obtains R, G, B, and A values from the buffer currently selected for reading (see ggllRReeaaddBBuuffffeerr). Each component value is divided by $2 sup 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 _v_a_l_u_e and added to the corresponding pixel component in the accumulation buffer, thereby updating the accumulation buffer.
GGLL__LLOOAADD
Similar to GGLL__AACCCCUUMM, 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 sup n^-^1$, multiplied by _v_a_l_u_e, and then stored in the corresponding accumulation buffer cell, overwriting the current value.
GGLL__AADDDD
Adds _v_a_l_u_e to each R, G, B, and A in the accumulation buffer.
GGLL__MMUULLTT
Multiplies each R, G, B, and A in the accumulation buffer by _v_a_l_u_e and returns the scaled component to its corresponding accumulation buffer location.
GGLL__RREETTUURRNN
Transfers accumulation buffer values to the color buffer or buffers currently selected for writing. Each R, G, B, and A component is multiplied by _v_a_l_u_e, then multiplied by $2 sup n^-^1$, clamped to the range [0,$~2 sup 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.

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

NOTES

Only pixels within the current scissor box are updated by a ggllAAccccuumm operation.

ERRORS

GGLL__IINNVVAALLIIDD__EENNUUMM is generated if _o_p is not an accepted value.

GGLL__IINNVVAALLIIDD__OOPPEERRAATTIIOONN is generated if there is no accumulation buffer.

GGLL__IINNVVAALLIIDD__OOPPEERRAATTIIOONN is generated if ggllAAccccuumm is executed between the execution of ggllBBeeggiinn and the corresponding execution of ggllEEnndd.

ASSOCIATED GETS

ggllGGeett with argument GGLL__AACCCCUUMM__RREEDD__BBIITTSS
ggllGGeett with argument GGLL__AACCCCUUMM__GGRREEEENN__BBIITTSS
ggllGGeett with argument GGLL__AACCCCUUMM__BBLLUUEE__BBIITTSS
ggllGGeett with argument GGLL__AACCCCUUMM__AALLPPHHAA__BBIITTSS

SEE ALSO

ggllCClleeaarr((33GG)), ggllCClleeaarrAAccccuumm((33GG)), ggllCCooppyyPPiixxeellss((33GG)), ggllDDrraawwBBuuffffeerr((33GG)), ggllGGeett((33GG)), ggllRReeaaddBBuuffffeerr((33GG)), ggllRReeaaddPPiixxeellss((33GG)), ggllSScciissssoorr((33GG)), ggllSStteenncciillOOpp((33GG))