varying vec2 texCoord;
//varying vec4 vColor;
uniform sampler2D colorMap;
uniform vec4 glColor;

/*
void main (void)
{
	gl_FragColor = texture2D(colorMap, texCoord);
}
*/

void main (void)
{
//vec2 nutexcoord;
//	nutexcoord=texCoord;
//	nutexcoord.x=1.0-nutexcoord.x;

	///gl_FragColor = texture2D(colorMap, texCoord);
	vec4 limit=glColor;
	vec4 tex=texture2D(colorMap, texCoord);
	float r,g,b,a;
	///r=tex.r; g=tex.g; b=tex.b; a=tex.a;
	r=min(tex.r,limit.r);
	g=min(tex.g,limit.g);
	b=min(tex.b,limit.b);
	a=min(tex.a,limit.a);
    ///gl_FragColor = gl_FragColor * glColor;
    gl_FragColor = vec4(r,g,b,a);

	//gl_FragColor = texture2D(colorMap, texCoord)*vColor;
	//gl_FragColor = texture2D(colorMap, nutexcoord);
}
