]> git.tdb.fi Git - libs/gl.git/blobdiff - source/framebuffer.cpp
Add post-processing effect framework
[libs/gl.git] / source / framebuffer.cpp
index d9d873bb7aa855de4491057a412178b964444f0e..7ae391a4a18c600dfe68c7461419dcaf3928d412 100644 (file)
@@ -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<FramebufferStatus>(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