sdrblurtest

view sdr/blur.glsl @ 0:26513fdda566

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 17 Oct 2013 08:19:56 +0300
parents
children
line source
1 uniform sampler2D tex;
2 uniform vec2 size, texsize;
4 #define KSZ 31
5 #define HALF_KSZ 15
6 #define SCALE float(KSZ * KSZ)
8 void main()
9 {
10 float pixw = 1.0 / texsize.x;
11 float pixh = 1.0 / texsize.y;
13 vec3 texel = vec3(0.0, 0.0, 0.0);
14 for(int i=0; i<KSZ; i++) {
15 for(int j=0; j<KSZ; j++) {
16 float x = float(j - HALF_KSZ) * pixw;
17 float y = float(i - HALF_KSZ) * pixh;
18 vec2 uv = gl_TexCoord[0].st + vec2(x, y);
19 texel += texture2D(tex, uv).rgb;
20 }
21 }
23 gl_FragColor.rgb = texel / SCALE;
24 gl_FragColor.a = 1.0;
25 }