Cylinder and Sphere use new setting of texture width and height. For that renaming windowWidth and windowHeight to textureWidth/Height. So finally the new argb decos work with cylinder and sphere.
svn path=/trunk/KDE/kdebase/workspace/; revision=959842
This commit is contained in:
parent
c0a20bd38f
commit
144f578a5d
2 changed files with 18 additions and 9 deletions
|
@ -1294,8 +1294,6 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP
|
|||
if( mode == Cylinder )
|
||||
{
|
||||
cylinderShader->bind();
|
||||
cylinderShader->setUniform( "windowWidth", (float)w->width() );
|
||||
cylinderShader->setUniform( "windowHeight", (float)w->height() );
|
||||
cylinderShader->setUniform( "xCoord", (float)w->x() );
|
||||
cylinderShader->setUniform( "cubeAngle", (effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f );
|
||||
cylinderShader->setUniform( "useTexture", 1.0f );
|
||||
|
@ -1310,8 +1308,6 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP
|
|||
if( mode == Sphere )
|
||||
{
|
||||
sphereShader->bind();
|
||||
sphereShader->setUniform( "windowWidth", (float)w->width() );
|
||||
sphereShader->setUniform( "windowHeight", (float)w->height() );
|
||||
sphereShader->setUniform( "xCoord", (float)w->x() );
|
||||
sphereShader->setUniform( "yCoord", (float)w->y() );
|
||||
sphereShader->setUniform( "cubeAngle", (effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f );
|
||||
|
@ -1324,6 +1320,19 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP
|
|||
sphereShader->setUniform( "timeLine", factor );
|
||||
data.shader = sphereShader;
|
||||
}
|
||||
if( data.shader )
|
||||
{
|
||||
int texw = w->width();
|
||||
int texh = w->height();
|
||||
if( !GLTexture::NPOTTextureSupported() )
|
||||
{
|
||||
kWarning( 1212 ) << "NPOT textures not supported, wasting some memory" ;
|
||||
texw = nearestPowerOfTwo(texw);
|
||||
texh = nearestPowerOfTwo(texh);
|
||||
}
|
||||
data.shader->setTextureWidth( texw );
|
||||
data.shader->setTextureHeight( texh );
|
||||
}
|
||||
//kDebug(1212) << w->caption();
|
||||
float opacity = cubeOpacity;
|
||||
if( start )
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
uniform sampler2D winTexture;
|
||||
uniform float windowWidth;
|
||||
uniform float windowHeight;
|
||||
uniform float textureWidth;
|
||||
uniform float textureHeight;
|
||||
uniform float opacity;
|
||||
uniform float brightness;
|
||||
uniform float saturation;
|
||||
|
@ -9,7 +9,7 @@ uniform float useTexture;
|
|||
|
||||
vec2 pix2tex(vec2 pix)
|
||||
{
|
||||
return vec2(pix.x / windowWidth, pix.y / windowHeight);
|
||||
return vec2(pix.x / textureWidth, pix.y / textureHeight);
|
||||
}
|
||||
|
||||
void main()
|
||||
|
@ -22,8 +22,8 @@ void main()
|
|||
if( useTexture > 0.0 )
|
||||
{
|
||||
// remove the shadow decoration quads
|
||||
if( gl_TexCoord[0].x < 0.0 || gl_TexCoord[0].x > windowWidth ||
|
||||
gl_TexCoord[0].y < 0.0 || gl_TexCoord[0].y > windowHeight )
|
||||
if( gl_TexCoord[0].x < 0.0 || gl_TexCoord[0].x > textureWidth ||
|
||||
gl_TexCoord[0].y < 0.0 || gl_TexCoord[0].y > textureHeight )
|
||||
discard;
|
||||
vec4 tex = texture2D(winTexture, pix2tex(gl_TexCoord[0].xy));
|
||||
tex = vec4( tex.rgb, tex.a * opacity );
|
||||
|
|
Loading…
Reference in a new issue