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.