varying vec2 texCoord;
uniform sampler2D colorMap;
uniform sampler2D palette;
uniform float verticalpalettepos;

void main (void)
{
    //float x=(texture2D(colorMap, texCoord).b+texture2D(colorMap, texCoord).r+texture2D(colorMap, texCoord).g)/3.0f;
    float x=texture2D(colorMap, texCoord).b;
    x=clamp(x,2.0f/256.0f,254.0f/256.0f);
    gl_FragColor = texture2D(palette, vec2(x,verticalpalettepos));
}
