glDrawBuffers — Specifies a list of color buffers to be drawn into
|const GLenum *||bufs|
Specifies the number of buffers in
Points to an array of symbolic constants specifying the buffers into which fragment colors or data values will be written.
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 will generate only one fragment color per fragment and it will be 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 will be 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 will be written into the first buffer specified by
bufs, the value of
gl_FragData will be 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
The symbolic constants contained in
bufs may be any of the following:
The fragment color/data value is not written into any color buffer.
The fragment color/data value is written into the front left color buffer.
The fragment color/data value is written into the front right color buffer.
The fragment color/data value is written into the back left color buffer.
The fragment color/data value is written into the back right color buffer.
The fragment color/data value is written into auxiliary buffer
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
glDrawBuffers is available only if the GL version is 2.0 or greater.
It is always the case that
The symbolic constants
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_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
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
GL_INVALID_OPERATION is generated if any of the entries 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
glGet with argument
glGet with argument
i indicates the number of the draw buffer whose value is to be queried
Copyright © 2003-2005 3Dlabs Inc. Ltd. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.