]> git.tdb.fi Git - libs/gl.git/commitdiff
Set read buffer as well as draw buffer for FBO
authorMikko Rasa <tdb@tdb.fi>
Wed, 2 Oct 2013 07:56:28 +0000 (10:56 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 2 Oct 2013 08:00:04 +0000 (11:00 +0300)
Apparently Nvidia drivers are too lax with this, but some others don't
like if the FBO has no color attachments and the read buffer is left at
its default setting of COLOR_ATTACHMENT0.

source/framebuffer.cpp

index 8e8be663e32f3ad48430b84eb9a55e1ed24543a0..8f54020009586cd5b20e97f64a7faa14d2327e17 100644 (file)
@@ -111,13 +111,20 @@ void Framebuffer::update_attachment(unsigned mask) const
                }
 
                if(color_bufs.empty())
+               {
                        glDrawBuffer(GL_NONE);
+                       glReadBuffer(GL_NONE);
+               }
                else if(color_bufs.size()==1)
+               {
                        glDrawBuffer(color_bufs.front());
+                       glReadBuffer(color_bufs.front());
+               }
                else
                {
                        static Require _req(ARB_draw_buffers);
                        glDrawBuffers(color_bufs.size(), &color_bufs[0]);
+                       glReadBuffer(color_bufs.front());
                }
        }
        else