
uniform lowp sampler2D g_Texture;
uniform lowp vec4 g_Color;

uniform lowp vec4 reverter;

varying highp vec2 texCoord;
varying lowp vec2 position;


void main()
{

	lowp vec4 colorOld = texture2D(g_Texture, texCoord);
	if (colorOld.a<=0.0) discard;
	
	lowp vec4 colorNew = vec4(colorOld.rgb,0);
	
	if (reverter.z == -1){
		lowp float temp = colorNew.r;
		colorNew.r = colorNew.g;
		colorNew.g = colorOld.a - temp;
	}else if (reverter.z == 1){
		lowp float temp = colorNew.r;
		colorNew.r = colorOld.a - colorNew.g;
		colorNew.g = temp;
	}
	
	if (reverter.x == 1){
		colorNew.r = colorOld.a-colorNew.r;
	}
	if (reverter.y == 1){
		colorNew.g = colorOld.a-colorNew.g;
	}
	
	
	
	gl_FragColor = g_Color * vec4(colorNew.rgb,colorOld.a);
}
