1 uniform sampler2D windowTex;
2 uniform sampler2D backgroundTex;
3 uniform float textureWidth;
4 uniform float textureHeight;
6 uniform float saturation;
7 uniform float brightness;
10 // Converts pixel coordinates to texture coordinates
11 vec2 pix2tex(vec2 pix)
13 return vec2(pix.x / textureWidth, pix.y / textureHeight);
16 // Returns color of the window at given texture coordinate, taking into
17 // account brightness and saturation, but not opacity
18 vec4 windowColor(vec2 texcoord)
20 vec4 color = texture2D(windowTex, texcoord);
22 float grayscale = dot(vec3(0.30, 0.59, 0.11), color.rgb);
23 color.rgb = mix(vec3(grayscale), color.rgb, saturation);
25 color.rgb = color.rgb * brightness;
32 vec2 blurtexcoord = pix2tex(gl_FragCoord.xy);
34 vec4 winColor = windowColor(gl_TexCoord[0].xy);
35 vec3 tex = mix(texture2D(backgroundTex, blurtexcoord).rgb,
36 winColor.rgb, winColor.a * opacity);
38 gl_FragColor = vec4(tex, pow(winColor.a, 0.2));