<p>You must fully create a renderbuffer <em>before</em> you can attach it to an FBO.</p>

<p>The <a href="https://www.opengl.org/wiki/OpenGL_Object#Object_Creation_and_Destruction" rel="nofollow noreferrer">pre-DSA OpenGL Object creation functions</a> do not create objects; they create object <em>names</em>. It's like creating an uninitialized pointer variable; it doesn't point to anything yet.</p>

<p>The actual creation of the object happens the first time the name is bound to the context. At that moment, the name is given a real object.</p>

<p>Under normal circumstances, it was pretty much impossible to use an object <em>without</em> binding it to the context, so this distinction couldn't be noticed. However, once the ability to attach objects to one another came to be, this distinction became noticeable.</p>

<p>Pre-DSA, the only way to fully create a renderbuffer object was to bind it to the context.</p>

<p>However, with <a href="https://www.opengl.org/wiki/Direct_State_Access" rel="nofollow noreferrer">ARB_DSA/GL 4.5</a>, the <code>glCreate*</code> functions actually <em>create objects</em> (imagine that!). So if you use <code>glCreateRenderbuffers</code>, you can attach the renderbuffer to an FBO without binding it first.</p>

CC BY-SA 3.0
2016-12-16T16:20:27.710Z
2016-12-16T16:20:27.710Z
Nicol Bolas
<p>The documentation of <code>glFramebufferRenderbuffer</code> only says that <code>renderbuffertarget</code> needs to be <code>GL_RENDERBUFFER</code>, though it does not specify that the attached renderbuffer, that is also given to the function, needs to be bound to <code>GL_RENDERBUFFER</code> beforehand.</p>

<p>I deem it not having to be so, because why would I have to specify the renderbuffer again if it should be bound beforehand?</p>

<p>Especially since the glNamedFramebufferRenderbuffer was introduced, it should not be nesseccary to bind anything.</p>

<opengl>
Renderbuffer needs to be bound before glFramebufferRenderbuffer?
salbeira
# Renderbuffer needs to be bound before glFramebufferRenderbuffer?

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

The documentation of `glFramebufferRenderbuffer` only says that `renderbuffertarget` needs to be `GL_RENDERBUFFER`, though it does not specify that the attached renderbuffer, that is also given to the function, needs to be bound to `GL_RENDERBUFFER` beforehand.

I deem it not having to be so, because why would I have to specify the renderbuffer again if it should be bound beforehand?

Especially since the glNamedFramebufferRenderbuffer was introduced, it should not be nesseccary to bind anything.

**Tags:** opengl


---

## 1 answers

### Answer by username_1 on 2016-12-16. Score: 3

You must fully create a renderbuffer *before* you can attach it to an FBO.

The [pre-DSA OpenGL Object creation functions](https://www.opengl.org/wiki/OpenGL_Object#Object_Creation_and_Destruction) do not create objects; they create object *names*. It's like creating an uninitialized pointer variable; it doesn't point to anything yet.

The actual creation of the object happens the first time the name is bound to the context. At that moment, the name is given a real object.

Under normal circumstances, it was pretty much impossible to use an object *without* binding it to the context, so this distinction couldn't be noticed. However, once the ability to attach objects to one another came to be, this distinction became noticeable.

Pre-DSA, the only way to fully create a renderbuffer object was to bind it to the context.

However, with [ARB\_DSA/GL 4.5](https://www.opengl.org/wiki/Direct_State_Access), the `glCreate*` functions actually *create objects* (imagine that!). So if you use `glCreateRenderbuffers`, you can attach the renderbuffer to an FBO without binding it first.


---

