Light | Dark

# docs.GL

OpenGL 4
OpenGL 3
OpenGL 2
OpenGL ES 3

# glReadBuffer

## Name

glReadBuffer — select a color buffer source for pixels

## C Specification

`void glReadBuffer(` | GLenum mode`)`;

## Parameters

`mode`

  Specifies a color buffer. Accepted values are `GL_BACK`, `GL_NONE`, and `GL_COLOR_ATTACHMENTi`.

## Description

`glReadBuffer` specifies a color buffer as the source for subsequent glReadPixels, , glCopyTexImage2D, glCopyTexSubImage2D, and glCopyTexSubImage3D commands. `mode` accepts one of the following values: `GL_NONE`, `GL_BACK` names the back buffer of the default framebuffer, and `GL_COLOR_ATTACHMENTi` names a color attachment of the current framebuffer,

## Errors

`GL_INVALID_ENUM` is generated if `mode` is not `GL_BACK`, `GL_NONE`, or `GL_COLOR_ATTACHMENTi`, where i is less than `GL_MAX_COLOR_ATTACHMENTS`.

`GL_INVALID_OPERATION` is generated if the current framebuffer is the default framebufer and `mode` is not `GL_NONE` or `GL_BACK`.

`GL_INVALID_OPERATION` is generated if the current framebuffer is a named framebufer and `mode` is not `GL_NONE` or `GL_COLOR_ATTACHMENTi`.

## Associated Gets

glGet with argument `GL_READ_BUFFER`

## API Version Support

| OpenGL ES API Version
--- | ---
Function Name | 2.0 | 3.0 | 3.1
glReadBuffer | - | ✔ | ✔

## See Also

glCopyTexImage2D, glCopyTexSubImage2D, glCopyTexSubImage3D, glDrawBuffers, glReadPixels

## Copyright

Copyright © 1991-2006 Silicon Graphics, Inc. Copyright © 2010-2014 Khronos Group. This document is licensed under the SGI Free Software B License. For details, see https://web.archive.org/web/20171022161616/http://oss.sgi.com/projects/FreeB/.

Think you can improve this page? Edit this page on GitHub.