
#version 130
precision mediump float;

uniform sampler2D SamplerBGRA;
//uniform sampler2D SamplerTableTex1;
//uniform sampler2D SamplerTableTex2;
//uniform sampler2D SamplerBackTex1;
//uniform sampler2D SamplerBackTex2;

out     vec4 		outText;	// output sampler

void main(void)
{
	vec2 v_texCoord = gl_TexCoord[0].st;

    mediump vec3 dst;
    mediump float lum;
    lowp float bound_l = 0.45;
    lowp float saturate = 0.1;
    
    dst.rgb = texture2D(SamplerBGRA, v_texCoord).rgb;        

    lum = dst.r*0.299 + dst.g*0.587 + dst.b*0.114;
    lum = (lum - bound_l)/saturate;
    lum = max(0.0,lum);
    lum = min(1.0,lum);
    outText = vec4(vec3(lum),1.0);
}