uniform vec2 resolution;

uniform sampler2D u_texture;
uniform sampler2D blur_texture;

varying vec4 v_fragmentColor;
varying vec2 v_texCoord;

void main(){

	//Blur target texture if framgent contains color;
	//ie. this place has some gui element in it
/*	 vec4 color = texture2D(u_texture, v_texCoord);
	
	 if(color.a > 0)
	 {*/
		float pixel_size = 1.0/resolution.y;

		vec4 sum = vec4(0);
		
		sum += texture2D(blur_texture, vec2(v_texCoord.x, v_texCoord.y - 4.0*pixel_size)) * 0.06;
		sum += texture2D(blur_texture, vec2(v_texCoord.x, v_texCoord.y - 3.0*pixel_size)) * 0.09;
		sum += texture2D(blur_texture, vec2(v_texCoord.x, v_texCoord.y - 2.0*pixel_size)) * 0.12;
		sum += texture2D(blur_texture, vec2(v_texCoord.x, v_texCoord.y - pixel_size))* 0.15;
		sum += texture2D(blur_texture, vec2(v_texCoord.x, v_texCoord.y)) * 0.16;
		sum += texture2D(blur_texture, vec2(v_texCoord.x, v_texCoord.y + pixel_size)) * 0.15;
		sum += texture2D(blur_texture, vec2(v_texCoord.x, v_texCoord.y + 2.0*pixel_size)) * 0.12;
		sum += texture2D(blur_texture, vec2(v_texCoord.x, v_texCoord.y + 3.0*pixel_size)) * 0.09;
		sum += texture2D(blur_texture, vec2(v_texCoord.x, v_texCoord.y + 4.0*pixel_size)) * 0.06;
		
		//sum.a = 1.0;
		gl_FragColor = sum;
/*	 }
	 else
	 {
		 gl_FragColor = vec4(0);
	 }*/
}