X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fframebuffer.cpp;h=7ae391a4a18c600dfe68c7461419dcaf3928d412;hb=119d9819ac9e9a8d274d2410beffe54e470485a3;hp=d9d873bb7aa855de4491057a412178b964444f0e;hpb=a361efc05fcad11b2918f3cd7abdebe794b131d8;p=libs%2Fgl.git diff --git a/source/framebuffer.cpp b/source/framebuffer.cpp index d9d873bb..7ae391a4 100644 --- a/source/framebuffer.cpp +++ b/source/framebuffer.cpp @@ -16,7 +16,7 @@ namespace GL { Framebuffer::Framebuffer() { - require_extension("GL_EXT_framebuffer_object"); + static RequireExtension _ext("GL_EXT_framebuffer_object"); glGenFramebuffersEXT(1, &id); bind(); @@ -30,7 +30,7 @@ Framebuffer::~Framebuffer() void Framebuffer::bind() const { glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, id); - current=this; + cur_fbo=this; } void Framebuffer::attach(FramebufferAttachment attch, Renderbuffer &rbuf) @@ -51,22 +51,27 @@ FramebufferStatus Framebuffer::check_status() const return static_cast(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT)); } +const Framebuffer *Framebuffer::current() +{ + return cur_fbo; +} + void Framebuffer::unbind() { - if(current) + if(cur_fbo) { glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - current=0; + cur_fbo=0; } } void Framebuffer::maybe_bind() const { - if(current!=this) + if(cur_fbo!=this) bind(); } -const Framebuffer *Framebuffer::current=0; +const Framebuffer *Framebuffer::cur_fbo=0; } // namespace GL } // namespace Msp