#ifdef GL_ES
precision mediump float;
#endif

uniform sampler2D texSampler;
uniform vec4 magicColor;
uniform float testAlpha;

varying lowp vec4 vColor;
varying vec2 vTexCoords;

void main() {
    vec4 frag = texture2D(texSampler, vTexCoords);
    if (frag.r == 1.0 && frag.g == 0.0 && frag.b == 1.0 && frag.a == 1.0) {
        frag = magicColor;
    }
    frag *= vColor;
    if (frag.a <= testAlpha)
        discard;
    gl_FragColor = frag;
}