uniform float pixel_size;
varying vec2 v_texCoord;
uniform sampler2D u_texture;

void main(){

	vec4 sum = vec4(0.0);

/*	float weights[10] = float[10](0.1329,0.1263,0.1063,0.08,0.0542,0.0334,0.0182,0.00998,0.003,0.001); 

	for(int i = 0; i < 10; i++)
	{
		sum += texture2D(u_texture, vec2(v_texCoord.x, v_texCoord.y - float(i)*pixel_size)) * weights[i];
		sum += texture2D(u_texture, vec2(v_texCoord.x, v_texCoord.y + float(i)*pixel_size)) * weights[i];
	}*/
	
	//TEMPPI!!!!
/*	gl_FragColor = texture2D(u_texture, v_texCoord);
	return;*/

/*	sum += texture2D(u_texture, vec2(v_texCoord.x, v_texCoord.y - 6.0*pixel_size)) * 0.045;
	sum += texture2D(u_texture, vec2(v_texCoord.x, v_texCoord.y - 5.0*pixel_size)) * 0.065;
	sum += texture2D(u_texture, vec2(v_texCoord.x, v_texCoord.y - 4.0*pixel_size)) * 0.08;
	sum += texture2D(u_texture, vec2(v_texCoord.x, v_texCoord.y - 3.0*pixel_size)) * 0.09;
	sum += texture2D(u_texture, vec2(v_texCoord.x, v_texCoord.y - 2.0*pixel_size)) * 0.12;
	sum += texture2D(u_texture, vec2(v_texCoord.x, v_texCoord.y - pixel_size)) * 0.15;
	sum += texture2D(u_texture, vec2(v_texCoord.x, v_texCoord.y)) * 0.16;
	sum += texture2D(u_texture, vec2(v_texCoord.x, v_texCoord.y + pixel_size)) * 0.15;
	sum += texture2D(u_texture, vec2(v_texCoord.x, v_texCoord.y + 2.0*pixel_size)) * 0.12;
	sum += texture2D(u_texture, vec2(v_texCoord.x, v_texCoord.y + 3.0*pixel_size)) * 0.09;
	sum += texture2D(u_texture, vec2(v_texCoord.x, v_texCoord.y + 4.0*pixel_size)) * 0.08;
	sum += texture2D(u_texture, vec2(v_texCoord.x, v_texCoord.y + 5.0*pixel_size)) * 0.065;
	sum += texture2D(u_texture, vec2(v_texCoord.x, v_texCoord.y + 6.0*pixel_size)) * 0.045;*/

//Linear blur testi

	int blur_size = 10;
	for(int i = 0; i < blur_size; i++)
	{
		sum += texture2D(u_texture, vec2(v_texCoord.x, v_texCoord.y - float(i)*pixel_size));
		sum += texture2D(u_texture, vec2(v_texCoord.x, v_texCoord.y + float(i)*pixel_size));
	}

	sum /= float(blur_size*2);


	//Amplify glow effect
	sum *= 1.0f; // oli 1.15
	//sum *= 0.5f;

	gl_FragColor = sum;
}