Fix untextured cube caps with GLSL

This commit is contained in:
Martin Gräßlin 2011-05-01 11:18:02 +02:00
parent a773a063b6
commit d396ce990b
2 changed files with 3 additions and 1 deletions

View file

@ -770,6 +770,7 @@ void CubeEffect::paintCap(bool frontFirst, float zOffset)
m_capShader->setUniform("screenTransformation", m_rotationMatrix);
}
m_capShader->setUniform("windowTransformation", capMatrix);
m_capShader->setUniform("u_untextured", texturedCaps ? 0 : 1);
if (texturedCaps && effects->numberOfDesktops() > 3 && capTexture) {
capTexture->bind();
}

View file

@ -2,6 +2,7 @@ uniform sampler2D sampler;
uniform vec4 u_capColor;
uniform float u_opacity;
uniform int u_mirror;
uniform int u_untextured;
varying vec2 varyingTexCoords;
@ -18,7 +19,7 @@ void main() {
vec2 texCoord = mirrorTex(varyingTexCoords);
vec4 tex = texture2D(sampler, texCoord);
if (texCoord.s < 0.0 || texCoord.s > 1.0 ||
texCoord.t < 0.0 || texCoord.t > 1.0) {
texCoord.t < 0.0 || texCoord.t > 1.0 || u_untextured != 0) {
tex = u_capColor;
}
color.rgb = tex.rgb*tex.a + color.rgb*(1.0-tex.a);