From 17543a09ba24b8cd012b842577f9bfcfa1faf070 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 2 Oct 2013 10:56:28 +0300 Subject: [PATCH] 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. --- source/framebuffer.cpp | 7 +++++++ 1 file changed, 7 insertions(+) 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 -- 2.45.2