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 3 of 3

Thread: Issue with glDrawBuffers when setting one of the entries to GL_NONE

  1. #1
    Intern Contributor
    Join Date
    Nov 2011
    Posts
    61

    Issue with glDrawBuffers when setting one of the entries to GL_NONE

    Hello,

    consider this simplified fragment shader
    Code :
    #version 150 core
     
    out vec4 Color0;
    out vec4 Color1;
    out vec4 Color2;
     
    void main(void)
    {
      Color0 = vec4(0.0, 0.0, 0.0, 0.3);
      Color1 = vec4(0.0, 0.0, 0.0, 0.5);
      Color2 = vec4(0.0, 0.0, 0.0, 0.8);
    }

    During shader linking the color outputs are mapped to draw buffer indices like this:
    Code :
    glBindFragDataLocation(Handle, 0, "Color0");
    glBindFragDataLocation(Handle, 1, "Color1");
    glBindFragDataLocation(Handle, 2, "Color2");

    The FBO has 3 color attachments:
    GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 and GL_COLOR_ATTACHMENT2.

    Before rendering with this fragment shader, glDrawBuffers is called like this:
    Code :
    GLenum buffers[3] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2 };
    glDrawBuffers(3, buffers);

    => The output is as expected, each of the 3 buffers receives the proper alpha value (also the RGB terms are the proper ones, so it is not about only the alpha part here).


    But now the problem:

    When I call
    glDrawBuffers like this (because I don't want to render to 2nd color buffer):
    Code :
    GLenum buffers[3] = { GL_COLOR_ATTACHMENT0, GL_NONE, GL_COLOR_ATTACHMENT2 };
    glDrawBuffers(3, buffers);

    => Then nothing is rendered to the 3rd color buffer! How is that possible? Where is my mistake?

    Help is really appreciated!
    ++i--;

  2. #2
    Intern Contributor
    Join Date
    Nov 2011
    Posts
    61
    I cannot reproduce this issue with an NVidia card (GTX 1080), so probably this is really a driver bug?!
    ++i--;

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2016
    Posts
    5
    I way just experimenting because of my fail understanding of glDrawBuffers and just checked your issue too.
    It seems to work on my NVidia Quadro 4200M (a really crappy Notebook card in comparasion with your 1080 )

Posting Permissions

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