<p>You can usually track down the answer for such questions in the OpenGL specification.  Assuming the value you care about is consistent across OpenGL versions (often the case for initial values, <a href="https://github.com/imallett/parse-GL-minimum-limits" rel="nofollow">seldom the case for minimum values</a>).</p>

<p>In this case, in the <a href="https://www.opengl.org/registry/doc/glspec45.core.pdf" rel="nofollow">GL 4.5 specification</a>, check out the following:</p>

<ul>
<li><code>glReadBuffer(...)</code> initial value: (default framebuffer: <code>GL_FRONT</code> iff single-buffered, <code>GL_BACK</code> iff double-buffered) (FBO: <code>GL_COLOR_ATTACHMENT0</code>) (see page 506)</li>
<li><code>glDrawBuffer(...)</code> initial value: (see <code>glDrawBuffers(...)</code>)</li>
<li><code>glDrawBuffers(...)</code> initial value: (default framebuffer: fragment color 0 goes to <code>GL_FRONT</code> iff single-buffered, <code>GL_BACK</code> iff double-buffered) (FBO: fragment color 0 goes to <code>GL_COLOR_ATTACHMENT0</code>) (both: fragment colors other than 0 go to <code>GL_NONE</code>) (see page 497)</li>
</ul>

CC BY-SA 3.0
2016-09-02T05:44:10.807Z
2016-09-02T05:44:10.807Z
geometrian
<p><a href="https://www.opengl.org/sdk/docs/man/html/glReadBuffer.xhtml" rel="noreferrer"><code>glReadBuffer(...)</code></a>/<a href="https://www.opengl.org/sdk/docs/man/html/glDrawBuffer.xhtml" rel="noreferrer"><code>glDrawBuffer(...)</code></a>/<a href="https://www.opengl.org/sdk/docs/man/html/glDrawBuffers.xhtml" rel="noreferrer"><code>glDrawBuffers(...)</code></a> access part of a framebuffer's state.</p>

<p>For reading the default framebuffer, this is <code>GL_FRONT</code> or <code>GL_BACK</code>.  However, the documentation doesn't say what it is for FBOs.  The only thing I found was an offhand comment <a href="http://www.lighthouse3d.com/tutorials/opengl_framebuffer_objects/" rel="noreferrer">here</a> stating that the default is GL_COLOR_ATTACHMENT0 (which is what I would guess).  Can I rely on that?</p>

<p>For writing, I didn't immediately find any claims what what color buffers are enabled.</p>

<opengl>
What Are The Default Values of `glReadBuffer/glDrawBuffer(s)` for an FBO?
geometrian
# What Are The Default Values of `glReadBuffer/glDrawBuffer(s)` for an FBO?

(Asked by: username_0 on 2016-09-02)

[`glReadBuffer(...)`](https://www.opengl.org/sdk/docs/man/html/glReadBuffer.xhtml)/[`glDrawBuffer(...)`](https://www.opengl.org/sdk/docs/man/html/glDrawBuffer.xhtml)/[`glDrawBuffers(...)`](https://www.opengl.org/sdk/docs/man/html/glDrawBuffers.xhtml) access part of a framebuffer's state.

For reading the default framebuffer, this is `GL_FRONT` or `GL_BACK`. However, the documentation doesn't say what it is for FBOs. The only thing I found was an offhand comment [here](http://www.lighthouse3d.com/tutorials/opengl_framebuffer_objects/) stating that the default is GL\_COLOR\_ATTACHMENT0 (which is what I would guess). Can I rely on that?

For writing, I didn't immediately find any claims what what color buffers are enabled.

**Tags:** opengl


---

## 1 answers

### Answer by username_0 on 2016-09-02. Score: 3

You can usually track down the answer for such questions in the OpenGL specification. Assuming the value you care about is consistent across OpenGL versions (often the case for initial values, [seldom the case for minimum values](https://github.com/imallett/parse-GL-minimum-limits)).

In this case, in the [GL 4.5 specification](https://www.opengl.org/registry/doc/glspec45.core.pdf), check out the following:

* `glReadBuffer(...)` initial value: (default framebuffer: `GL_FRONT` iff single-buffered, `GL_BACK` iff double-buffered) (FBO: `GL_COLOR_ATTACHMENT0`) (see page 506)
* `glDrawBuffer(...)` initial value: (see `glDrawBuffers(...)`)
* `glDrawBuffers(...)` initial value: (default framebuffer: fragment color 0 goes to `GL_FRONT` iff single-buffered, `GL_BACK` iff double-buffered) (FBO: fragment color 0 goes to `GL_COLOR_ATTACHMENT0`) (both: fragment colors other than 0 go to `GL_NONE`) (see page 497)


---

