#version 120

uniform sampler2D texture1;

float weight[4] = float[] (0.24609375,
                           0.205078125,
                           0.1171875,
                           0.0439453125);

float offset[4] = float[] (0.0 / 128.0,
                           1.0 / 128.0,
                           2.0 / 128.0,
                           3.0 / 128.0);
void main()
{
  vec2 uv0 = gl_TexCoord[0].xy;

  vec2 uv1n = vec2(uv0.x - offset[1], uv0.y); // temp[1]
  vec2 uv1p = vec2(uv0.x + offset[1], uv0.y); //

  vec2 uv2n = vec2(uv0.x - offset[2], uv0.y); // temp[2]
  vec2 uv2p = vec2(uv0.x + offset[2], uv0.y); //

  vec2 uv3n = vec2(uv0.x - offset[3], uv0.y); // temp[3]
  vec2 uv3p = vec2(uv0.x + offset[3], uv0.y); //

  vec3 s0  = texture2D(texture1, uv0).rgb;

  vec3 s1n = texture2D(texture1, uv1n).rgb;
  vec3 s1p = texture2D(texture1, uv1p).rgb;

  vec3 s2n = texture2D(texture1, uv2n).rgb;
  vec3 s2p = texture2D(texture1, uv2p).rgb;

  vec3 s3n = texture2D(texture1, uv3n).rgb;
  vec3 s3p = texture2D(texture1, uv3p).rgb;

  vec3 col = s0 * weight[0];

  col = s1n * weight[1] + col;
  col = s1p * weight[1] + col;

  col = s2n * weight[2] + col;
  col = s2p * weight[2] + col;

  col = s3p * weight[3] + col;
  col = s3n * weight[3] + col;

  //gl_FragColor = vec4(col, 1.0);
  gl_FragColor = vec4(s0, 1.0);
}
