GL_DRAW / READ_FRAMEBUFFER vs GL_FRAMEBUFFER?

I noticed that now there are extensions GL_DRAW / READ_FRAMEBUFFER. Currently, I just use GL_FRAMEBUFFER and glTextureBarrierNV. However, I did not find much about the READ / WRITE extensions and therefore had some questions.

What is the version of OpenGL? What benefits do they provide by using just GL_FRAMEBUFFER for reading and writing? Where can I find more information about this?

+6
source share
2 answers

Note "Pedantry": GL_DRAW/READ_FRAMEBUFFER were not added to the extension; they are the main features of OpenGL 3.0. Yes, technically this functionality is also displayed in ARB_framebuffer_objects, but it is an extension of the main core , and it is still the main GL 3.0.

In any case, if you want the etymology of the DRAW/READ difference, you need to look at EXT_framebuffer_blit . It was there that these counters originated, and that is why these counters exist. Instead of just specifying two FBOs for blit from / to, they created two context anchor points for the framebuffers. The glBlitFramebuffer command approaches the current bound READ_FRAMEBUFFER to the currently bound DRAW_FRAMEBUFFER .

If you are not using blit, you really don't need DRAW/READ demarcation. This does not mean that you should not use it. glReadPixels is read from READ_FRAMEBUFFER . The binding to GL_FRAMEBUFFER bound to both points, so your code can still work. But sometimes it’s useful to have an FBO binding that can be read from it that does not interfere with drawing.

+12
source

If you mean the constants GL_READ_FRAMEBUFFER and GL_DRAW_FRAMEBUFFER , they come from the EXT_framebuffer_blit extension, which later became the core in OpenGL 3.0 and the special ARB_framebuffer_object extension (together with the EXT_framebuffer_multisample and the original EXT_framebuffer_object .

They allow you to bind separate FBOs for read and draw operations. This is especially useful for FBO copy operations for FBOs introduced by EXT_framebuffer_blit (which allow you to copy data directly from one FBO to another) and for allowing multisampled FBOs entered (and necessary) to EXT_framebuffer_multisample , which actually creates the aforementioned blitz extension superimposed. When you bind FBO to GL_FRAMEBUFFER you actually bind it to both GL_READ_FRAMEBUFFER and GL_DRAW_FRAMEBUFFER .

As said, all of these FBO extensions were created in OpenGL 3.0, but may also be available for earlier versions. Check here for more information.

+3
source

Source: https://habr.com/ru/post/903985/


All Articles