kwin/effects/data/sharpen.frag
Rivo Laks 5af2cb8dda Add sharpen effect which does some basic sharpening.
Also requires shaders and shortcut is Ctrl+F7 for now.

svn path=/trunk/KDE/kdebase/workspace/; revision=683165
2007-07-04 10:01:04 +00:00

24 lines
767 B
GLSL

uniform sampler2D sceneTex;
uniform float textureWidth;
uniform float textureHeight;
// Converts pixel coordinates to texture coordinates
vec2 pix2tex(vec2 pix)
{
return vec2(pix.x / textureWidth, 1.0 - pix.y / textureHeight);
}
void main()
{
float amount = 0.4;
vec3 tex = texture2D(sceneTex, pix2tex(gl_TexCoord[0].xy)).rgb * (1.0 + 4.0 * amount);
tex -= texture2D(sceneTex, pix2tex(gl_TexCoord[0].xy + vec2(0.0, 1.0))).rgb * amount;
tex -= texture2D(sceneTex, pix2tex(gl_TexCoord[0].xy + vec2(0.0, -1.0))).rgb * amount;
tex -= texture2D(sceneTex, pix2tex(gl_TexCoord[0].xy + vec2(1.0, 0.0))).rgb * amount;
tex -= texture2D(sceneTex, pix2tex(gl_TexCoord[0].xy + vec2(-1.0, 0.0))).rgb * amount;
gl_FragColor = vec4(tex, 1.0);
}