+#include "arb_draw_buffers.h"
#include "error.h"
#include "ext_framebuffer_blit.h"
#include "ext_framebuffer_object.h"
{
if(current()==this)
{
- GLenum color_buf = GL_NONE;
+ std::vector<GLenum> color_bufs;
+ color_bufs.reserve(attachments.size());
for(unsigned i=0; i<attachments.size(); ++i)
{
const Attachment &attch = attachments[i];
}
if(attch.attachment>=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;