void glDrawBuffers(GLsizei n, const GLenum *bufs)
glDrawBuffers defines an array of buffers into which fragment color values or fragment data will be written. If no fragment shader is active, rendering operations generate only one fragment color per fragment and that fragment is written into each of the buffers specified by bufs. If a fragment shader is active and it writes a value to the output variable gl_FragColor, then that value is written into each of the buffers specified by bufs. If a fragment shader is active and it writes a value to one or more elements of the output array variable gl_FragData, then the value of gl_FragData is written into the first buffer specified by bufs, the value of gl_FragData is written into the second buffer specified by bufs, and so on up to gl_FragData[n-1]. The draw buffer used for gl_FragData[n] and beyond is implicitly set to be GL_NONE.
The symbolic constants contained in bufs may be any of the following:
Except for GL_NONE, the preceding symbolic constants may not appear more than once in bufs. The maximum number of draw buffers supported is implementation dependent and can be queried by calling glGet with the argument GL_MAX_DRAW_BUFFERS. The number of auxiliary buffers can be queried by calling glGet with the argument GL_AUX_BUFFERS.
glDrawBuffers is available only if the GL version is 2.0 or greater.
It is always the case that GL_AUXi = GL_AUX0 + i.
The symbolic constants GL_FRONT, GL_BACK, GL_LEFT, GL_RIGHT, and GL_FRONT_AND_BACK are not allowed in the bufs array since they may refer to multiple buffers.
If a fragment shader writes to neither gl_FragColor nor gl_FragData, the values of the fragment colors following shader execution are undefined. For each fragment generated in this situation, a different value may be written into each of the buffers specified by bufs.
GL_INVALID_ENUM is generated if one of the values in bufs is not an accepted value.
GL_INVALID_ENUM is generated if n is less than 0.
GL_INVALID_OPERATION is generated if a symbolic constant other than GL_NONE appears more than once in bufs.
GL_INVALID_OPERATION is generated if any entry in bufs (other than GL_NONE) indicates a color buffer that does not exist in the current GL context.
GL_INVALID_VALUE is generated if n is greater than GL_MAX_DRAW_BUFFERS.
GL_INVALID_OPERATION is generated if glDrawBuffers is executed between the execution of glBegin and the corresponding execution of glEnd.
glGet with argument GL_MAX_DRAW_BUFFERS
glGet with argument GL_DRAW_BUFFERSi where i indicates the number of the draw buffer whose value is to be queried
glBlendFunc, glColorMask, glDrawBuffer, glIndexMask, glLogicOp, glReadBuffer