]> git.tdb.fi Git - libs/gl.git/commitdiff
Setting depth mask off in Framebuffer is not required
authorMikko Rasa <tdb@tdb.fi>
Thu, 9 Dec 2010 20:56:22 +0000 (20:56 +0000)
committerMikko Rasa <tdb@tdb.fi>
Thu, 9 Dec 2010 20:56:22 +0000 (20:56 +0000)
Re-enable depth mask when unbinding depth test

source/framebuffer.cpp
source/tests.cpp

index a0fcbc474203c5588d04e410bf4d0975c49fa983..ea28d5db2d261eeb999d1e6c05eea38b6aefe70a 100644 (file)
@@ -53,7 +53,6 @@ void Framebuffer::update_attachment(unsigned mask) const
        if(current()==this)
        {
                GLenum color_buf = GL_NONE;
-               bool has_depth = false;
                for(unsigned i=0; i<attachments.size(); ++i)
                {
                        const Attachment &attch = attachments[i];
@@ -72,12 +71,9 @@ void Framebuffer::update_attachment(unsigned mask) const
 
                        if(attch.attachment>=COLOR_ATTACHMENT0 && attch.attachment<=COLOR_ATTACHMENT3)
                                color_buf = attch.attachment;
-                       if(attch.attachment==DEPTH_ATTACHMENT)
-                               has_depth = true;
                }
 
                glDrawBuffer(color_buf);
-               glDepthMask(has_depth);
        }
        else
                dirty |= mask;
index a741b268a998dd31aa425f7df2f647a3095ab2b2..1a2a58352e2605a54669093c5cb4e2011557c774 100644 (file)
@@ -70,7 +70,11 @@ const DepthTest &DepthTest::lequal()
 void DepthTest::unbind()
 {
        if(set_current(0))
+       {
                glDisable(GL_DEPTH_TEST);
+               // Allow glClear(GL_DEPTH_BUFFER_BIT) to work
+               glDepthMask(true);
+       }
 }
 
 void depth_func(Predicate func)