GLDRAWBUFFERS(3G)

  .SH "NAME" glDrawBuffers, glNamedFramebufferDrawBuffers - Specifies a list of color buffers to be drawn into
  .SH "C SPECIFICATION"

      .HP u void glDrawBuffers(GLsizei n, const GLenum *bufs);
      .HP u void glNamedFramebufferDrawBuffers(GLuint framebuffer, GLsizei n, const GLenum *bufs);

  .SH "PARAMETERS"

      .PP framebuffer

              Specifies the name of the framebuffer object for glNamedFramebufferDrawBuffers.

          .RE
          .PP n

                  Specifies the number of buffers in bufs.

              .RE
              .PP bufs

                      Points to an array of symbolic constants specifying the buffers into which fragment colors or data values will be written.

                  .RE

              .SH "DESCRIPTION"

                .PP glDrawBuffers and glNamedFramebufferDrawBuffers define an array of buffers into which outputs from the fragment shader data will be written. If a fragment shader writes a value to one or more user defined output variables, then the value of each variable will be written into the buffer specified at a location within bufs corresponding to the location assigned to that user defined output. The draw buffer used for user defined outputs assigned to locations greater than or equal to n is implicitly set to GL_NONE and any data written to such an output is discarded.
                .PP For glDrawBuffers, the framebuffer object that is bound to the GL_DRAW_FRAMEBUFFER binding will be used. For glNamedFramebufferDrawBuffers, framebuffer is the name of the framebuffer object. If framebuffer is zero, then the default framebuffer is affected.
                .PP The symbolic constants contained in bufs may be any of the following:

                  .PP GL_NONE

                          The fragment shader output value is not written into any color buffer.

                      .RE
                      .PP GL_FRONT_LEFT

                              The fragment shader output value is written into the front left color buffer.

                          .RE
                          .PP GL_FRONT_RIGHT

                                  The fragment shader output value is written into the front right color buffer.

                              .RE
                              .PP GL_BACK_LEFT

                                      The fragment shader output value is written into the back left color buffer.

                                  .RE
                                  .PP GL_BACK_RIGHT

                                          The fragment shader output value is written into the back right color buffer.

                                      .RE
                                      .PP GL_COLOR_ATTACHMENTn

                                              The fragment shader output value is written into the nth color attachment of the current framebuffer. n may range from zero to the value of GL_MAX_COLOR_ATTACHMENTS.

                                          .RE

                                        .PP 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.

                                      .SH "NOTES"

                                        .PP 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.
                                        .PP If a fragment shader does not write to a user defined output variable, 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.

                                      .SH "ERRORS"

                                        .PP GL_INVALID_OPERATION error is generated by glNamedFramebufferDrawBuffers if framebuffer is not zero or the name of an existing framebuffer object.
                                        .PP GL_INVALID_ENUM is generated if one of the values in bufs is not an accepted value.
                                        .PP GL_INVALID_ENUM is generated if the API call refers to the default framebuffer and one or more of the values in bufs is one of the GL_COLOR_ATTACHMENTn tokens.
                                        .PP GL_INVALID_ENUM is generated if the API call refers to a framebuffer object and one or more of the values in bufs is anything other than GL_NONE or one of the GL_COLOR_ATTACHMENTn tokens.
                                        .PP GL_INVALID_ENUM is generated if n is less than 0.
                                        .PP GL_INVALID_OPERATION is generated if a symbolic constant other than GL_NONE appears more than once in bufs.
                                        .PP 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.
                                        .PP GL_INVALID_OPERATION is generated if any value in bufs is GL_BACK, and n is not one.
                                        .PP GL_INVALID_VALUE is generated if n is greater than GL_MAX_DRAW_BUFFERS.

                                      .SH "ASSOCIATED GETS"

                                        .PP glGet() with argument GL_MAX_DRAW_BUFFERS
                                        .PP glGet() with argument GL_DRAW_BUFFERi where i indicates the number of the draw buffer whose value is to be queried.

                                      .SH "VERSION SUPPORT"

                                            .TS allbox tab(:); lB cB s s s s s s s s s s s lB cB cB cB cB cB cB cB cB cB cB cB cB. T{ T}:T{ OpenGL Version T} T{ Function / Feature Name T}:T{ 2.0 T}:T{ 2.1 T}:T{ 3.0 T}:T{ 3.1 T}:T{ 3.2 T}:T{ 3.3 T}:T{ 4.0 T}:T{ 4.1 T}:T{ 4.2 T}:T{ 4.3 T}:T{ 4.4 T}:T{ 4.5 T} l c c c c c c c c c c c c l c c c c c c c c c c c c. T{ glDrawBuffers T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T} T{ glNamedFramebufferDrawBuffers T}:T{ - T}:T{ - T}:T{ - T}:T{ - T}:T{ - T}:T{ - T}:T{ - T}:T{ - T}:T{ - T}:T{ - T}:T{ - T}:T{ ✔ T}

                                        .SH "SEE ALSO"
                                        .PP glBlendFunc(), glColorMask(), glDrawBuffers(), glLogicOp(), glReadBuffer()

                                        .SH "COPYRIGHT"
                                            .PP Copyright © 2003-2005 3Dlabs Inc. Ltd. Copyright © 2010-2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. https://opencontent.org/openpub/.

COPYRIGHT
Copyright © 2003-2005 3Dlabs Inc. Ltd.
Copyright © 2010-2014 Khronos Group