From: Mikko Rasa Date: Wed, 2 Oct 2013 07:56:28 +0000 (+0300) Subject: Set read buffer as well as draw buffer for FBO X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=commitdiff_plain;h=17543a09ba24b8cd012b842577f9bfcfa1faf070;ds=sidebyside Set read buffer as well as draw buffer for FBO 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. --- diff --git a/source/framebuffer.cpp b/source/framebuffer.cpp index 8e8be663..8f540200 100644 --- a/source/framebuffer.cpp +++ b/source/framebuffer.cpp @@ -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