uniform sampler2D tex0;
uniform vec2 size;
uniform float zo;

uniform float _strength;

void main()
{
	  float Strength = _strength;    
    const int Samples = 64; //multiple of 2
    
    vec2 uv = gl_FragCoord.xy/size.xy;
    
	  vec2 dir = uv - vec2(0.5);
  
    vec4 color = vec4(0.0,0.0,0.0,0.0);
    
    /*for (int i = 0; i < Samples; i += 2) //operating at 2 samples for better performance
    {
        color += texture(tex0,uv+float(i)/float(Samples)*dir*Strength);
        color += texture(tex0,uv+float(i+1)/float(Samples)*dir*Strength);
    }   
    
    gl_FragColor = color/float(Samples);*/
    
    
    
    float w = 1.0;
    for (int i = 0; i < Samples; i++) //operating at 2 samples for better performance
    {
        vec2 c = uv+   float(i)/float(Samples)*dir*Strength;
        if (c.x >= 0.0 && c.x < 1 && c.y >= 0.0 && c.y < 1)
        {
          color += texture(tex0, c);
          w++;
        }
    }   
    
    gl_FragColor = color/w;
    
}
	
