public void SetBlendFactor(Color4 blendFactor)
 {
     NewBlendFactor = blendFactor;
 }
        public void Clear(Texture renderTarget, Color4 color)
        {
#if DEBUG
            GraphicsDevice.EnsureContextActive();
#endif

            var clearFBO = GraphicsDevice.FindOrCreateFBO(renderTarget);
            if (clearFBO != boundFBO)
                GL.BindFramebuffer(FramebufferTarget.Framebuffer, clearFBO);

            // Check if we need to change color mask
            var blendState = currentPipelineState.BlendState;
            var needColorMaskOverride = blendState.ColorWriteChannels != ColorWriteChannels.All;

            if (needColorMaskOverride)
                GL.ColorMask(true, true, true, true);

            GL.ClearColor(color.R, color.G, color.B, color.A);
            GL.Clear(ClearBufferMask.ColorBufferBit);

            // revert the color mask value as it was before
            if (needColorMaskOverride)
                blendState.RestoreColorMask();

            if (clearFBO != boundFBO)
                GL.BindFramebuffer(FramebufferTarget.Framebuffer, boundFBO);
        }