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
|
@ -552,12 +552,25 @@ void SceneOpenGL::Window::draw()
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef( glX(), glY(), depth );
|
glTranslatef( glX(), glY(), depth );
|
||||||
if( toplevel->opacity() != 1.0 )
|
if( toplevel->opacity() != 1.0 )
|
||||||
|
{
|
||||||
|
if( toplevel->hasAlpha())
|
||||||
{
|
{
|
||||||
glEnable( GL_BLEND );
|
glEnable( GL_BLEND );
|
||||||
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||||
glColor4f( toplevel->opacity(), toplevel->opacity(), toplevel->opacity(),
|
glColor4f( toplevel->opacity(), 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 );
|
||||||
foreach( QRect r, shape().rects())
|
foreach( QRect r, shape().rects())
|
||||||
|
|
Loading…
Reference in a new issue