uniform sampler2D tex;

void main(void)
{
	ivec2 pos[4] = {ivec2(1,0),ivec2(-1,0),ivec2(0,1),ivec2(0,-1)};

	vec4 color = texture2D(tex, gl_TexCoord[0].xy);
	color = vec4(gl_Color.x,gl_Color.y,gl_Color.z,color.w);
	if(color.w <= 0.0)
	{
		for(int i = 0; i < 4; i++)
		{
			vec4 t_color = textureOffset(tex, gl_TexCoord[0].xy,pos[i]);
			if(t_color.y > 0.0)
			{
				color = vec4(0.0,0.0,0.0,1.0);
			}
		}
	}

   gl_FragColor = color;
}