]> git.tdb.fi Git - libs/gl.git/commitdiff
Don't bind RenderBuffer in constructor
authorMikko Rasa <tdb@tdb.fi>
Sun, 10 Oct 2010 09:49:41 +0000 (09:49 +0000)
committerMikko Rasa <tdb@tdb.fi>
Sun, 10 Oct 2010 09:49:41 +0000 (09:49 +0000)
Use correct parameter for glDrawBuffer

source/framebuffer.cpp
source/renderbuffer.cpp

index 8dbd2d0ee93bd20940b26326c1d2aaeb0c3f25a1..77ac21be6b0e6ef76da3928247b54b2c69074c5b 100644 (file)
@@ -52,7 +52,7 @@ void Framebuffer::update_attachment(unsigned mask) const
 {
        if(current()==this)
        {
-               bool has_color = false;
+               GLenum color_buf = GL_NONE;
                bool has_depth = false;
                for(unsigned i=0; i<attachments.size(); ++i)
                {
@@ -68,12 +68,12 @@ void Framebuffer::update_attachment(unsigned mask) const
                        }
 
                        if(attch.attachment>=COLOR_ATTACHMENT0 && attch.attachment<=COLOR_ATTACHMENT3)
-                               has_color = true;
+                               color_buf = attch.attachment;
                        if(attch.attachment==DEPTH_ATTACHMENT)
                                has_depth = true;
                }
 
-               glDrawBuffer(has_color ? GL_FRONT : GL_NONE);
+               glDrawBuffer(color_buf);
                glDepthMask(has_depth);
        }
        else
index 95cf56b8a06f49a8dcb0984936a5f86bc11fc405..d28237bed7e33f55aa5ae7245c63e98707bb06e1 100644 (file)
@@ -17,7 +17,6 @@ Renderbuffer::Renderbuffer()
        static RequireExtension _ext("GL_EXT_framebuffer_object");
 
        glGenRenderbuffersEXT(1, &id);
-       bind();
 }
 
 Renderbuffer::~Renderbuffer()