From bcabc01eccff736a7710c14cade68088b4f314c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sun, 5 Dec 2010 10:02:47 +0000 Subject: [PATCH] Fix blend func for shaders svn path=/trunk/KDE/kdebase/workspace/; revision=1203714 --- scene_opengl.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scene_opengl.cpp b/scene_opengl.cpp index a5277001ca..1efe3b000e 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -1680,13 +1680,18 @@ void SceneOpenGL::Window::prepareShaderRenderStates( TextureType type, double op // setup blending of transparent windows glPushAttrib( GL_ENABLE_BIT ); bool opaque = isOpaque() && opacity == 1.0; + bool alpha = toplevel->hasAlpha() || type != Content; if( type != Content ) opaque = false; - if( !opaque ) - { - glEnable( GL_BLEND ); - glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA ); + if (!opaque) { + glEnable(GL_BLEND); + if (alpha) { + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } else { + glBlendColor((float)opacity, (float)opacity, (float)opacity, (float)opacity); + glBlendFunc(GL_ONE, GL_ONE_MINUS_CONSTANT_ALPHA); } + } shader->setUniform("opacity", (float)opacity); shader->setUniform("saturation", (float)saturation); shader->setUniform("brightness", (float)brightness);