'''_glReadBuffer:''' select a color buffer source for pixel read operations from the current read framebuffer.


{{PageSyntax}}

  SUB _glReadBuffer (BYVAL mode AS _UNSIGNED LONG)
  void '''_glReadBuffer'''(GLenum {{Parameter|mode}});


; mode
: Specifies a color buffer. Accepted values are {{KW|_GL_FRONT_LEFT}}, {{KW|_GL_FRONT_RIGHT}}, {{KW|_GL_BACK_LEFT}}, {{KW|_GL_BACK_RIGHT}}, {{KW|_GL_FRONT}}, {{KW|_GL_BACK}}, {{KW|_GL_LEFT}}, {{KW|_GL_RIGHT}}, and the constants {{KW|_GL_COLOR_ATTACHMENT''i''}}.


{{PageDescription}}

'''_glReadBuffer''' specifies which color buffer within the current bound {{KW|_GL_READ_FRAMEBUFFER}} will be used as the source for pixel reading commands. These commands include: {{KW|_glBlitFramebuffer}}, {{KW|_glReadPixels}}, {{KW|_glCopyTexImage1D}}, {{KW|_glCopyTexImage2D}}, {{KW|_glCopyTexSubImage1D}}, {{KW|_glCopyTexSubImage2D}}, and {{KW|_glCopyTexSubImage3D}}.

{{Parameter|mode}} accepts one of twelve or more predefined values. If the [[default framebuffer]] (the zero [[framebuffer object]])is bound to {{KW|_GL_READ_FRAMEBUFFER}}, then the following enumerators can be used: {{KW|_GL_FRONT}}, {{KW|_GL_LEFT}}, and {{KW|_GL_FRONT_LEFT}} all name the front left buffer, {{KW|_GL_FRONT_RIGHT}} and {{KW|_GL_RIGHT}} name the front right buffer, and {{KW|_GL_BACK_LEFT}} and {{KW|_GL_BACK}} name the back left buffer. Nonstereo double-buffered configurations have only a front left and a back left buffer. Single-buffered configurations have a front left and a front right buffer if stereo, and only a front left buffer if nonstereo.

If a non-zero framebuffer object is bound, then the constants {{KW|_GL_COLOR_ATTACHMENT''i''}} may be used to indicate the ''i''&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; color attachment, where ''i'' ranges from zero to the value of {{KW|_GL_MAX_COLOR_ATTACHMENTS}} minus one.

It is an error to specify a nonexistent buffer to '''_glReadBuffer'''.

For the default framebuffer, {{Parameter|mode}} is initially {{KW|_GL_FRONT}} in single-buffered configurations and {{KW|_GL_BACK}} in double-buffered configurations. For framebuffer objects, the default read buffer is {{KW|_GL_COLOR_ATTACHMENT0}}.


{{PageErrors}}

{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|mode}} is not one of the twelve (or more) accepted values.

{{KW|_GL_INVALID_OPERATION}} is generated if {{Parameter|mode}} specifies a buffer that does not exist.


{{PageUseWith}}

{{KW|_glGet}} with argument {{KW|_GL_READ_BUFFER}}


{{PageSeeAlso}}

{{KW|_GL}}
{{KW|_glBindFramebuffer}}, {{KW|_glDrawBuffer}}, {{KW|_glDrawBuffers}}, {{KW|_glReadPixels}}


{{PageCopyright}}

Copyright 1991-2006 Silicon Graphics, Inc. Copyright 2011 Khronos Group. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].