The first such operation is controlling the buffer into which color values are written. This is accomplished with
void DrawBuffer ( enum buf ) ;
buf is a symbolic constant specifying zero, one, two, or four buffers for writing. The constants are NONE, FRONT_LEFT, FRONT_RIGHT, BACK_LEFT, BACK_RIGHT, FRONT, BACK, LEFT, RIGHT, FRONT_AND_BACK, and AUX0 through AUXn, where n+1 is the number of available auxiliary buffers.
The constants refer to the four potentially visible buffers front_left, front_right, back_left, and back_right, and to the auxiliary buffers. Arguments other than AUXi that omit reference to LEFT or RIGHT refer to both left and right buffers. Arguments other than AUXi that omit reference to FRONT or BACK refer to both front and back buffers. AUXi enables drawing only to auxiliary buffer i. Each AUXi adheres to . The constants and the buffers they indicate are summarized in Table 4.4. If DrawBuffer is is supplied with a constant (other than NONE) that does not indicate any of the color buffers allocated to the GL context, the error INVALID_OPERATION results.
Table 4.4: Arguments to DrawBuffer and the buffers that they indicate.
Indicating a buffer or buffers using DrawBuffer causes subsequent pixel color value writes to affect the indicated buffers. If more than one color buffer is selected for drawing, blending and logical operations are computed and applied independently for each buffer. Calling DrawBuffer with a value of NONE inhibits the writing of color values to any buffer.
Monoscopic contexts include only left buffers, while stereoscopic contexts include both left and right buffers. Likewise, single buffered contexts include only front buffers, while double buffered contexts include both front and back buffers. The type of context is selected at GL initialization.
The state required to handle buffer selection is a set of up to 4 + n bits. 4 bits indicate if the front left buffer, the front right buffer, the back left buffer, or the back right buffer, are enabled for color writing. The other n bits indicate which of the auxiliary buffers is enabled for color writing. In the initial state, the front buffer or buffers are enabled if there are no back buffers; otherwise, only the back buffer or buffers are enabled.