#version 130
uniform sampler2D texture;
in vec2 texCoord;
in vec4 color;
out vec4 final;
void main(void)
{
vec4 myColor = color;
final = texture2D(texture, texCoord);
int P = 1;
int outline = 0;
if (final.a == 0.0)
{
vec4 px[4] = vec4[](
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 < 4; ++i)
{
if(px[i].a > 0.0)
{
myColor = vec4(1.0, 0.0, 0.0, 1.0);
outline++;
}
}
if(outline == 0)
discard;
}
final = myColor;
}