#version 130

uniform sampler2D t0;
uniform vec2 vsize;

void main(void) {
	vec2 tc = gl_TexCoord[0].xy, dt = 2. / vsize, dt2 = dt + dt;
	gl_FragColor = (texture2D(t0, tc) * 3. +
					textureOffset(t0, tc, ivec2(1, 0)) * 2. +
					textureOffset(t0, tc, ivec2(0, 1)) * 2. +
					textureOffset(t0, tc, ivec2(-1, 0)) * 2. +
					textureOffset(t0, tc, ivec2(0, -1)) * 2. +
					textureOffset(t0, tc, ivec2(1, 1)) * 1.5 +
					textureOffset(t0, tc, ivec2(1, -1)) * 1.5 +
					textureOffset(t0, tc, ivec2(-1, -1)) * 1.5 +
					textureOffset(t0, tc, ivec2(-1, 1)) * 1.5 +
					textureOffset(t0, tc, ivec2(2, 0)) +
					textureOffset(t0, tc, ivec2(0, 2)) +
					textureOffset(t0, tc, ivec2(-2, 0)) +
					textureOffset(t0, tc, ivec2(0, -2)) +
					textureOffset(t0, tc, ivec2(2, 1)) +
					textureOffset(t0, tc, ivec2(2, -1)) +
					textureOffset(t0, tc, ivec2(-2, -1)) +
					textureOffset(t0, tc, ivec2(-2, 1)) +
					textureOffset(t0, tc, ivec2(1, 2)) +
					textureOffset(t0, tc, ivec2(1, -2)) +
					textureOffset(t0, tc, ivec2(-1, -2)) +
					textureOffset(t0, tc, ivec2(-1, 2))) / 29.;
	//gl_FragColor = texture2D(t0, tc);
}
