sdrblurtest
diff sdr/vblur.glsl @ 0:26513fdda566
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 17 Oct 2013 08:19:56 +0300 |
parents | |
children | e8fc0c9754c9 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/sdr/vblur.glsl Thu Oct 17 08:19:56 2013 +0300 1.3 @@ -0,0 +1,21 @@ 1.4 +uniform sampler2D tex; 1.5 +uniform vec2 size, texsize; 1.6 + 1.7 +#define KSZ 31 1.8 +#define HALF_KSZ 15 1.9 +#define SCALE float(KSZ) 1.10 + 1.11 +void main() 1.12 +{ 1.13 + float pixh = 1.0 / texsize.y; 1.14 + 1.15 + vec3 texel = vec3(0.0, 0.0, 0.0); 1.16 + for(int i=0; i<KSZ; i++) { 1.17 + float y = float(i - HALF_KSZ) * pixh; 1.18 + vec2 uv = gl_TexCoord[0].st + vec2(0.0, y); 1.19 + texel += texture2D(tex, uv).rgb; 1.20 + } 1.21 + 1.22 + gl_FragColor.rgb = texel / SCALE; 1.23 + gl_FragColor.a = 1.0; 1.24 +}