uniform sampler2D tex0;
uniform int amount;
uniform vec2 size;

void main(void)
{
	/*if (gl_TexCoord[0].s > 0.5 || gl_TexCoord[0].t > 0.5)
	{
		discard;
	}*/

	float step = 3.0 / (size.x);

	vec4 texel, color = vec4(0.0);
	int i;
	float w, sum = 0.0;

	for (i = -amount; i <= amount; i++)
	{
		texel = texture2D(tex0, gl_TexCoord[0].st + vec2(float(i) * step, 0.0));

		//w = amount == 0 ? 1.0 : exp(-pow(float(i) / float(amount) * 1.5, 2.0));
		w = 1.0;

		color += texel * w;

		sum += w;
	}

	gl_FragData[0] = color / sum;
  //gl_FragData[0] = vec4(1.0, 0.3, 0.0, 1.0);
}


