Fix blend func for shaders

svn path=/trunk/KDE/kdebase/workspace/; revision=1203714
This commit is contained in:
Martin Gräßlin 2010-12-05 10:02:47 +00:00
parent 8ef7cec838
commit bcabc01ecc

View file

@ -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);