5
$\begingroup$

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.

$\endgroup$

1 Answer 1

3
$\begingroup$

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

The pre-DSA OpenGL Object creation functions 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, 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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.