X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fframebuffer.cpp;h=672495182f7f641bbf419c2ea5b35dd28af6c28e;hb=61ff840cd211f10d45dca8c4dad2cca5f68aaa42;hp=8e8be663e32f3ad48430b84eb9a55e1ed24543a0;hpb=619aae12e01f25e79626a94c973927e5599e99a5;p=libs%2Fgl.git diff --git a/source/framebuffer.cpp b/source/framebuffer.cpp index 8e8be663..67249518 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 @@ -206,7 +213,7 @@ void Framebuffer::detach(FramebufferAttachment attch) FramebufferStatus Framebuffer::check_status() const { - Bind _bind(this, true); + BindRestore _bind(this); return static_cast(glCheckFramebufferStatus(GL_FRAMEBUFFER)); } @@ -219,7 +226,7 @@ void Framebuffer::require_complete() const void Framebuffer::clear(BufferBits bits) { - Bind _bind(this, true); + BindRestore _bind(this); glClear(bits); } @@ -272,7 +279,7 @@ void Framebuffer::bind() const } const Framebuffer *Framebuffer::current() -{ +{ if(!cur_obj) cur_obj = &system(); return cur_obj;