X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fframebuffer.cpp;h=1c2ae519bade1ef1059df7ff1a43dbdd33a23440;hb=9ea7e740503b09298ae814b1bf521312d1744db2;hp=8c618ce51b7112ba96f4332cb1e08de683744397;hpb=357acfb941a8b5b4a6fb36e2134707d46e028d88;p=libs%2Fgl.git diff --git a/source/framebuffer.cpp b/source/framebuffer.cpp index 8c618ce5..1c2ae519 100644 --- a/source/framebuffer.cpp +++ b/source/framebuffer.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include "error.h" #include "framebuffer.h" #include "misc.h" @@ -109,22 +110,17 @@ void Framebuffer::update_attachment(unsigned mask) const color_bufs.push_back(attch.attachment); } - 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 - { + if(color_bufs.size()>1) static Require _req(ARB_draw_buffers); + + GLenum first_buffer = (color_bufs.empty() ? GL_NONE : color_bufs.front()); + if(ARB_draw_buffers) glDrawBuffers(color_bufs.size(), &color_bufs[0]); - glReadBuffer(color_bufs.front()); - } + else if(MSP_draw_buffer) + glDrawBuffer(first_buffer); + + if(MSP_draw_buffer) + glReadBuffer(first_buffer); } else dirty |= mask;