]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/pipelinestate.cpp
Tweak handling flags in PipelineState::set_framebuffer
[libs/gl.git] / source / core / pipelinestate.cpp
index 97f353dcee8b572c835e1ac5569ca9769489b246..78db195d4b28d891a484b3d42268577973e065be 100644 (file)
@@ -69,7 +69,7 @@ void PipelineState::set(T &target, T value, unsigned flag)
 
 void PipelineState::set_framebuffer(const Framebuffer *f)
 {
-       set(framebuffer, f, FRAMEBUFFER|VIEWPORT);
+       set(framebuffer, f, FRAMEBUFFER);
 }
 
 void PipelineState::set_viewport(const Rect *v)
@@ -172,7 +172,7 @@ void PipelineState::apply(unsigned mask) const
                }
        }
 
-       if(mask&VIEWPORT)
+       if(mask&(VIEWPORT|FRAMEBUFFER))
        {
                if(viewport)
                        glViewport(viewport->left, viewport->bottom, viewport->width, viewport->height);
@@ -322,9 +322,14 @@ void PipelineState::apply(unsigned mask) const
                        glBlendEquation(get_gl_blend_equation(blend->equation));
                        glBlendFunc(get_gl_blend_factor(blend->src_factor), get_gl_blend_factor(blend->dst_factor));
                        glBlendColor(blend->constant.r, blend->constant.g, blend->constant.b, blend->constant.a);
+                       ColorWriteMask cw = blend->write_mask;
+                       glColorMask((cw&WRITE_RED)!=0, (cw&WRITE_GREEN)!=0, (cw&WRITE_BLUE)!=0, (cw&WRITE_ALPHA)!=0);
                }
                else
+               {
                        glDisable(GL_BLEND);
+                       glColorMask(true, true, true, true);
+               }
        }
 
        last_applied = this;