#vertexshader

void main()
{
	gl_Position = ftransform();
	gl_TexCoord[0] = gl_MultiTexCoord0;
}

#fragmentshader

uniform vec2 offsets[8];
uniform sampler2D color_texture;

const vec4 threshold0 = vec4(1.0, 0.9, 0.8,0.7);
const vec4 threshold1 = vec4(0.6, 0.5, 0.3,0.1);
const float totalweight = 1.0/ (1.0 + (0.9+0.8+0.7+0.6+0.5+0.3+0.1)*2.0);

void main()
{
	vec4 c = vec4(0.0, 0.0, 0.0, 0.0);
	
	c += texture2D(color_texture, gl_TexCoord[0].xy+offsets[0]) * threshold0.x;

	c += texture2D(color_texture, gl_TexCoord[0].xy+offsets[1]) * threshold0.y;
	c += texture2D(color_texture, gl_TexCoord[0].xy+offsets[2]) * threshold0.z;
	c += texture2D(color_texture, gl_TexCoord[0].xy+offsets[3]) * threshold0.w;
	c += texture2D(color_texture, gl_TexCoord[0].xy+offsets[4]) * threshold1.x;
	c += texture2D(color_texture, gl_TexCoord[0].xy+offsets[5]) * threshold1.y;
	c += texture2D(color_texture, gl_TexCoord[0].xy+offsets[6]) * threshold1.z;
	c += texture2D(color_texture, gl_TexCoord[0].xy+offsets[7]) * threshold1.w;

	c += texture2D(color_texture, gl_TexCoord[0].xy-offsets[1]) * threshold0.y;
	c += texture2D(color_texture, gl_TexCoord[0].xy-offsets[2]) * threshold0.z;
	c += texture2D(color_texture, gl_TexCoord[0].xy-offsets[3]) * threshold0.w;
	c += texture2D(color_texture, gl_TexCoord[0].xy-offsets[4]) * threshold1.x;
	c += texture2D(color_texture, gl_TexCoord[0].xy-offsets[5]) * threshold1.y;
	c += texture2D(color_texture, gl_TexCoord[0].xy-offsets[6]) * threshold1.z;
	c += texture2D(color_texture, gl_TexCoord[0].xy-offsets[7]) * threshold1.w;
	
	c *= totalweight;
	
	gl_FragColor = c;
	/*gl_FragColor = texture2D(color_texture, gl_TexCoord[0].xy);
	gl_FragColor = vec4(1,1,1,1);*/
}
