Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: glDrawBuffer does not accept GL_COLOR_ATTACHMENT0 but glReadBuffer does?

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2011
    Posts
    23

    Question glDrawBuffer does not accept GL_COLOR_ATTACHMENT0 but glReadBuffer does?

    Hello,

    I see lots of code around the web where the following is done:

    Code :
    glDrawBuffer(GL_COLOR_ATTACHMENT0);

    But looking into the manual glDrawBuffer (in contrast to glReadBuffer and glDrawBuffers)
    does NOT accept GL_COLOR_ATTACHMENTX as parameter.

    So wondering what is the proper usage of glDrawBuffer and why does glReadBuffer
    accept color attachments but glDrawBuffer does not?

    I am also a bit confused how to setup things with glReadBuffer/glDrawBuffer/glDrawBuffers
    when doing a glBlitFramebuffer on a framebuffer which has only a depth/depth-stencil texture
    attached but no color attachment at all?

    Help is really appreciated!
    ++i--;

  2. #2
    Junior Member Regular Contributor Agent D's Avatar
    Join Date
    Sep 2011
    Location
    Innsbruck, Austria
    Posts
    143
    In the OpenGL(R) 3.3 specification, it says, that glDrawBuffer accepts an enumerator from tables 4.4 or 4.5. Table 4.5 lists the enumerators NONE and COLOR_ATTACHMENTi with the caption underneath saying that this is perfectly fine when "...the context is bound to a framebuffer object".

    I guess that the man pages just lag behind or whoever's responsible missed to update that section.

  3. #3
    Intern Contributor
    Join Date
    May 2013
    Posts
    67
    Quote Originally Posted by RealtimeSlave View Post
    I am also a bit confused how to setup things with glReadBuffer/glDrawBuffer/glDrawBuffers
    when doing a glBlitFramebuffer on a framebuffer which has only a depth/depth-stencil texture
    attached but no color attachment at all?
    A framebuffer can only have one depth and/or one stencil target. This can be as two separate buffers or as one combination buffer.
    You tell glBlitFramebuffer what combination of depth/stencil/color you want to copy via bitmask. Because there is only one depth and one stencil you don't have to preselect them like the color targets.

    For a framebuffer without any color targets you would only set GL_DEPTH_BUFFER_BIT and/or GL_STENCIL_BUFFER_BIT. And the value of glReadBuffer/glDrawBuffer/glDrawBuffers doesn't matter.

  4. #4
    Junior Member Newbie
    Join Date
    Nov 2011
    Posts
    23
    Quote Originally Posted by Agent D View Post
    In the OpenGL(R) 3.3 specification, it says, that glDrawBuffer accepts an enumerator from tables 4.4 or 4.5. Table 4.5 lists the enumerators NONE and COLOR_ATTACHMENTi with the caption underneath saying that this is perfectly fine when "...the context is bound to a framebuffer object".

    I guess that the man pages just lag behind or whoever's responsible missed to update that section.
    I see, thanks!


    Quote Originally Posted by Osbios View Post
    A framebuffer can only have one depth and/or one stencil target. This can be as two separate buffers or as one combination buffer.
    You tell glBlitFramebuffer what combination of depth/stencil/color you want to copy via bitmask. Because there is only one depth and one stencil you don't have to preselect them like the color targets.

    For a framebuffer without any color targets you would only set GL_DEPTH_BUFFER_BIT and/or GL_STENCIL_BUFFER_BIT. And the value of glReadBuffer/glDrawBuffer/glDrawBuffers doesn't matter.
    Alright, got it! Thanks
    ++i--;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •