uniform sampler2D mGlyph;
uniform sampler2D mTransfer;
uniform float mArrowAlpha;
uniform vec3 mArrowColor;


void main (void) 
{
	float sinv = gl_TexCoord[2].x;
	float cosv = gl_TexCoord[2].y;
	float signumx = gl_TexCoord[2].z;
	float signumy = gl_TexCoord[2].w;

	mat2 rotation = mat2(cosv, sinv, -sinv, cosv);
	
	vec2 h = vec2(0.5, 0.5);

	vec2 spritelookup = (rotation * (gl_PointCoord - h)) + h;

	vec4 coldebug = ( signumy == 1.0) ? vec4(1.0, 1.0, 1.0, 0.0) : vec4(1.0, 0.0, 0.0, 0.0);

	vec4 lookupcolor = texture2D(mGlyph, spritelookup);
	vec4 finalcolor = vec4(1.0, 1.0, 1.0, 1.0) - lookupcolor;
	finalcolor.a = lookupcolor.a * mArrowAlpha;
	finalcolor.rgb = finalcolor.rgb * mArrowColor;

	gl_FragColor =  finalcolor;//(texture2D(mGlyph, spritelookup) * mArrowAlpha);
	//gl_FragColor =  vec4(1.0, 1.0, 1.0, 1.0);

}