A new way of adjusting opacity of non-alpha windows from glcompmgr,
the alpha way doesn't work with TFP for some reason. svn path=/branches/work/kwin_composite/; revision=594941
This commit is contained in:
parent
085b06a1b3
commit
5de53a53e6
1 changed files with 17 additions and 4 deletions
|
@ -553,10 +553,23 @@ void SceneOpenGL::Window::draw()
|
||||||
glTranslatef( glX(), glY(), depth );
|
glTranslatef( glX(), glY(), depth );
|
||||||
if( toplevel->opacity() != 1.0 )
|
if( toplevel->opacity() != 1.0 )
|
||||||
{
|
{
|
||||||
glEnable( GL_BLEND );
|
if( toplevel->hasAlpha())
|
||||||
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
{
|
||||||
glColor4f( toplevel->opacity(), toplevel->opacity(), toplevel->opacity(),
|
glEnable( GL_BLEND );
|
||||||
toplevel->opacity());
|
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||||
|
glColor4f( toplevel->opacity(), toplevel->opacity(), toplevel->opacity(),
|
||||||
|
toplevel->opacity());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float constant_alpha[] = { 0, 0, 0, toplevel->opacity() };
|
||||||
|
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE );
|
||||||
|
glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE );
|
||||||
|
glTexEnvi( GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE );
|
||||||
|
glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE );
|
||||||
|
glTexEnvi( GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_CONSTANT );
|
||||||
|
glTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant_alpha );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
glEnable( GL_TEXTURE_RECTANGLE_ARB );
|
glEnable( GL_TEXTURE_RECTANGLE_ARB );
|
||||||
glBegin( GL_QUADS );
|
glBegin( GL_QUADS );
|
||||||
|
|
Loading…
Reference in a new issue