The accumulation buffer is designed for combining multiple images. Instead of simply replacing pixel values with incoming pixel fragments, the fragments are scaled and then added to the existing pixel value. In order to maintain accuracy over many blending operations, the accumulation buffer has a higher number of bits per color component than a typical color buffer.
The accumulation buffer can be cleared like any other buffer. You can use glClearAccum() to set the red, green, blue, and alpha components of its clear color. Clear the accumulation buffer by bitwise or'ing in the GL_ACCUM_BUFFER_BIT value to the parameter of the glClear() command.
You can't render directly into the accumulation buffer. Instead you render into a selected color buffer, then use glAccum() to accumulate that image into the accumulation buffer. The glAccum() command reads from the currently selected read buffer. You can set the buffer you want it to read from using the glReadBuffer() command.
The glAccum() command takes two arguments, op and value. The possible settings for op are described in Table 2.
Since you must render to another buffer before accumulating, a typical approach to accumulating images is to render images to the back buffer some number of times, accumulating each image into the accumulation buffer. When the desired number of images have been accumulated, the contents of the accumulation buffer are copied into the back buffer, and the buffers are swapped. This way, only the final accumulated image is displayed.
Here is an example procedure for accumulating n images:
Note that the first two steps are only necessary if the application has changed the selected draw and read buffers. If the visual is double buffered, these settings are the default.
The accumulation buffer provides a way to take ``multiple exposures'' of a scene, while maintaining good color resolution. There are a number of image effects that can be implemented with the accumulation buffer to improve the realism of a rendered image [43,70], including antialiasing, motion blur, soft shadows, and depth of field. To create these effects, render the image multiple times, making small, incremental changes to the scene position (or selected objects within the scene), and accumulate the results.