#version 130
uniform sampler2D texture;
in vec2 texCoord;
in vec4 color;
out vec4 final;
void main(void)
{
vec4 myColor = color;
float P = 1.0 / 512.0;
float treshold = 0.2;
final = texture2D(texture, texCoord);
if (final.a <= treshold)
discard;
vec4 px[8] = vec4[](
texture2D(texture, texCoord+vec2(P, P)),
texture2D(texture, texCoord+vec2(-P, P)),
texture2D(texture, texCoord+vec2(-P, -P)),
texture2D(texture, texCoord+vec2(P, -P)),
texture2D(texture, texCoord+vec2(P, 0)),
texture2D(texture, texCoord+vec2(0, P)),
texture2D(texture, texCoord+vec2(-P, 0)),
texture2D(texture, texCoord+vec2(0, -P))
);
for(int i = 0; i < 8; ++i)
{
if(px[i].a <= treshold)
myColor = vec4(vec3(0.0), 1.0);
}
final = myColor;
}