uniform sampler2D mVelocity;
uniform sampler2D mTransfer;
uniform sampler2D mGlyph;
uniform float maxMagnitude;
uniform float minMagnitude;


void main (void) 
{
	vec4 lookup = texture2D(mVelocity, gl_TexCoord[0].xy);
	float len = ( length(lookup.xy) - minMagnitude ) / ( maxMagnitude - minMagnitude );
	
	vec4 color = texture2D(mTransfer, vec2(len, 0.5));

	//vec4 glcolor = texture2D(mGlyph, gl_TexCoord[1].xy);

	vec4 finalcolor = vec4(1.0, 1.0, 1.0, 1.0)/* - glcolor*/;
	//finalcolor.a = glcolor.a;
	finalcolor = finalcolor * color;

	finalcolor.a *= gl_Color.a;

	gl_FragColor = finalcolor;
}