I've noticed that there now are the GL_DRAW/READ_FRAMEBUFFER extensions. Currently I am simply using GL_FRAMEBUFFER and glTextureBarrierNV. However, I have not found that much about the READ/WRITE extensions and thus have some questions.
What OpenGL version were they introduced? What advantages do they give over using simply GL_FRAMEBUFFER for both read and write? Where can I find more info about this?
Pedantic note: GL_DRAW/READ_FRAMEBUFFER
were not introduced in an extension; they are core OpenGL 3.0 functionality. Yes, technically this functionality is also exposed in ARB_framebuffer_objects, but that is a core extension and it is still core GL 3.0.
In any case, if you want the etymology of the DRAW/READ
distinction, you need to look to EXT_framebuffer_blit. That is where those enumerators originated, and that is why those enumerators exist. Instead of just specifying two FBOs to blit from/to, they created two context binding points for framebuffers. The glBlitFramebuffer
command blits from the currently bound READ_FRAMEBUFFER
to the currently bound DRAW_FRAMEBUFFER
.
If you are not using blit, then you don't really need the DRAW/READ
distinction. That doesn't mean you shouldn't use it however. glReadPixels
reads from the READ_FRAMEBUFFER
. Binding to GL_FRAMEBUFFER
binds to both points, so your code can still work. But it is sometimes useful to have an FBO binding which can be read from that doesn't interfere with drawing operations.
In case you mean the GL_READ_FRAMEBUFFER
and GL_DRAW_FRAMEBUFFER
constants, these come from the EXT_framebuffer_blit extension, which was later made core in OpenGL 3.0 and into a special ARB_framebuffer_object extension (together with EXT_framebuffer_multisample
and the original EXT_framebuffer_object
, of course) for versions <3.
They allow you to bind separate FBOs for reading and drawing operations. This is especially useful for the FBO to FBO copy operations introduced by EXT_framebuffer_blit
(which allow you to copy data directly from one FBO to another) and for the resolving of multisampled FBOs introduced (and needed) by EXT_framebuffer_multisample
, which actually builds ontop of the afore mentioned blit extension. When binding an FBO to GL_FRAMEBUFFER
, you actually bind it to both GL_READ_FRAMEBUFFER
and GL_DRAW_FRAMEBUFFER
.
Like said all these FBO extension were made core in OpenGL 3.0, but may also be available to earlier versions. Look here for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With