+++ /dev/null
-/* $Id$
-
-This file is part of libmspgl
-Copyright © 2007 Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
-#include "extension.h"
-#include "ext_framebuffer_object.h"
-#include "framebuffer.h"
-#include "renderbuffer.h"
-#include "texture2d.h"
-
-namespace Msp {
-namespace GL {
-
-Framebuffer::Framebuffer()
-{
- require_extension("GL_EXT_framebuffer_object");
-
- glGenFramebuffersEXT(1, &id);
- bind();
-}
-
-Framebuffer::~Framebuffer()
-{
- glDeleteFramebuffersEXT(1, &id);
-}
-
-void Framebuffer::bind() const
-{
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, id);
- current=this;
-}
-
-void Framebuffer::attach(FramebufferAttachment attch, Renderbuffer &rbuf)
-{
- maybe_bind();
- glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, attch, GL_RENDERBUFFER_EXT, rbuf.get_id());
-}
-
-void Framebuffer::attach(FramebufferAttachment attch, Texture2D &tex, int level)
-{
- maybe_bind();
- glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attch, tex.get_target(), tex.get_id(), level);
-}
-
-FramebufferStatus Framebuffer::check_status() const
-{
- maybe_bind();
- return static_cast<FramebufferStatus>(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT));
-}
-
-void Framebuffer::unbind()
-{
- if(current)
- {
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
- current=0;
- }
-}
-
-void Framebuffer::maybe_bind() const
-{
- if(current!=this)
- bind();
-}
-
-const Framebuffer *Framebuffer::current=0;
-
-} // namespace GL
-} // namespace Msp