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,12 +1680,17 @@ void SceneOpenGL::Window::prepareShaderRenderStates( TextureType type, double op
// setup blending of transparent windows // setup blending of transparent windows
glPushAttrib( GL_ENABLE_BIT ); glPushAttrib( GL_ENABLE_BIT );
bool opaque = isOpaque() && opacity == 1.0; bool opaque = isOpaque() && opacity == 1.0;
bool alpha = toplevel->hasAlpha() || type != Content;
if( type != Content ) if( type != Content )
opaque = false; opaque = false;
if( !opaque ) if (!opaque) {
{
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA ); 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("opacity", (float)opacity);
shader->setUniform("saturation", (float)saturation); shader->setUniform("saturation", (float)saturation);