summaryrefslogtreecommitdiff
path: root/render/fx_renderer/gles2/shaders/blur1.frag
blob: e7cb1be8e78bd3622cec5ef74568ec872bc675e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
precision mediump float;
varying mediump vec2 v_texcoord;
uniform sampler2D tex;

uniform float radius;
uniform vec2 halfpixel;

void main() {
    vec2 uv = v_texcoord * 2.0;

    vec4 sum = texture2D(tex, uv) * 4.0;
    sum += texture2D(tex, uv - halfpixel.xy * radius);
    sum += texture2D(tex, uv + halfpixel.xy * radius);
    sum += texture2D(tex, uv + vec2(halfpixel.x, -halfpixel.y) * radius);
    sum += texture2D(tex, uv - vec2(halfpixel.x, -halfpixel.y) * radius);

    gl_FragColor = sum / 8.0;
}