X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fframebuffer.cpp;h=98722195e32e8b10d40a43ab3d458d4c1ae5f4af;hb=e1df3aa732d4d2d03f6ac72a8dead099937a0468;hp=43b0f94b82e4c882327ef686491453a1bc7cf263;hpb=6afbace895a7bbcf216ab8e48280ea0303ab5892;p=libs%2Fgl.git diff --git a/source/framebuffer.cpp b/source/framebuffer.cpp index 43b0f94b..98722195 100644 --- a/source/framebuffer.cpp +++ b/source/framebuffer.cpp @@ -1,3 +1,4 @@ +#include "arb_draw_buffers.h" #include "error.h" #include "ext_framebuffer_blit.h" #include "ext_framebuffer_object.h" @@ -46,7 +47,8 @@ void Framebuffer::update_attachment(unsigned mask) const { if(current()==this) { - GLenum color_buf = GL_NONE; + std::vector color_bufs; + color_bufs.reserve(attachments.size()); for(unsigned i=0; i=COLOR_ATTACHMENT0 && attch.attachment<=COLOR_ATTACHMENT3) - color_buf = attch.attachment; + color_bufs.push_back(attch.attachment); } - glDrawBuffer(color_buf); + if(color_bufs.empty()) + glDrawBuffer(GL_NONE); + else if(color_bufs.size()==1) + glDrawBuffer(color_bufs.front()); + else + { + static Require _req(ARB_draw_buffers); + glDrawBuffers(color_bufs.size(), &color_bufs[0]); + } } else dirty |= mask;