next up previous contents index
Next: 4.3 DrawingReading, and Up: 4.2 Whole Framebuffer Operations Previous: 4.2.3 Clearing the Buffers

4.2.4 The Accumulation Buffer

Each portion of a pixel in the accumulation buffer consists of four values: one for each of R, G, B, and A. The accumulation buffer is controlled exclusively through the use of

void Accum ( enum op, float value ) ;

(except for clearing it). op is a symbolic constant indicating an accumulation buffer operation, and value is a floating-point value to be used in that operation. The possible operations are ACCUM, LOAD, RETURN, MULT, and ADD.

The accumulation buffer operations apply identically to every pixel, so we describe the effect of each operation on an individual pixel. Accumulation buffer values are taken to be signed values in the range . Using ACCUM obtains R, G, B, and A components from the buffer currently selected for reading (section 4.3.2). Each component, considered as a fixed-point value in [0,1] (see section 2.13.9), is converted to floating-point. Each result is then multiplied by value. The results of this multiplication are then added to the corresponding color component currently in the accumulation buffer, and the resulting color value replaces the current accumulation buffer color value. The LOAD operation has the same effect as ACCUM, but the computed values replace the corresponding accumulation buffer components rather than being added to them.

The RETURN operation takes each color value from the accumulation buffer, multiplies each of the R, G, B, and A components by value. The resulting color value is placed in the buffers currently enabled for color writing as if it were a fragment produced from rasterization, except that the only per-fragment operations applied are the pixel ownership test and, if enabled, dithering (section 4.1); color masking (section 4.2.2) is also applied.

The MULT operation multiplies each R, G, B, and A in the accumulation buffer by value and then returns the scaled color components to their corresponding accumulation buffer locations. ADD is the same as MULT except that value is added to each of the color components.

The color components operated on by Accum  must be clamped only if the operation is RETURN. In this case, a value sent to the enabled color buffers is first clamped to . Otherwise, results are undefined if the result of an operation on a color component is out of the range . When the scissor test is enabled (section 4.1.2), then only those pixels within the current scissor box are updated by any Accum  operation; otherwise, all pixels in the window are updated. If there is no accumulation buffer, or if the GL is in color index mode, Accum  generates the error INVALID_OPERATION.

No state (beyond the accumulation buffer itself) is required for accumulation buffering.

next up previous contents index
Next: 4.3 DrawingReading, and Up: 4.2 Whole Framebuffer Operations Previous: 4.2.3 Clearing the Buffers

David Blythe
Sat Mar 29 02:23:21 PST 1997