
varying vec4 vpos;
uniform sampler2D colorMap;
uniform sampler2D dramaMap;
uniform float tlx;
uniform float tly;
uniform float drx;
uniform float dry;
uniform float boxscalex;
uniform float boxscaley;
uniform float gradientselect;
varying vec4 flatvpos;
varying vec4 boxpos;
uniform float testvalue;


void main (void)
{





	
	
	


	
	
	
	
	
	
	
	
	
	
	boxscalex=drx-tlx;
	boxscaley=dry-tly;

	float x=(boxpos.x-tlx)/boxscalex; float y=(boxpos.y-tly)/boxscaley;
	
	vec2 texCoord=vec2(x,y);
	vec4 col1=texture2D(dramaMap, clamp(texCoord,2.0/256.0,254.0/256.0));
	vec4 col2=texture2D(colorMap, clamp(vec2(1.0-col1.r,gradientselect),2.0/256.0,254.0/256.0));
	gl_FragColor = col2;
	
	
}
