SFML/examples/shader/resources/blur.sfx

21 lines
881 B
Plaintext
Raw Normal View History

uniform sampler2D texture;
uniform float offset;
void main()
{
vec2 offx = vec2(offset, 0.0);
vec2 offy = vec2(0.0, offset);
2011-05-15 19:36:13 +08:00
vec4 pixel = texture2D(texture, gl_TexCoord[0].xy) * 1.0 +
texture2D(texture, gl_TexCoord[0].xy - offx) * 2.0 +
texture2D(texture, gl_TexCoord[0].xy + offx) * 2.0 +
texture2D(texture, gl_TexCoord[0].xy - offy) * 2.0 +
texture2D(texture, gl_TexCoord[0].xy + offy) * 2.0 +
texture2D(texture, gl_TexCoord[0].xy - offx - offy) * 1.0 +
texture2D(texture, gl_TexCoord[0].xy - offx + offy) * 1.0 +
texture2D(texture, gl_TexCoord[0].xy + offx - offy) * 1.0 +
texture2D(texture, gl_TexCoord[0].xy + offx + offy) * 1.0;
gl_FragColor = gl_Color * (pixel / 13.0);
}