[vert.glsl]

#version 130

in vec2 in_position;

out vec2 pass_position;

void main()
{
    pass_position = in_position;
    gl_Position = vec4(in_position, 0.0, 1.0);
}

[frag.glsl]

#version 130

#if defined GL_ES
precision highp float;
#endif

in vec2 pass_position;

uniform sampler2D u_texture;

vec3 rand_color(float t)
{
    return vec3(0.5 + 0.5 * sin(t * 19.0 + 17.0),
                0.5 + 0.5 * sin(t * 24.0 + 23.0),
                0.5 + 0.5 * sin(t * 37.0 + 12.0));
}

void main(void)
{
    vec2 texcoords = pass_position * 0.5 + vec2(0.5, 0.5);
    vec4 src_color = texture2D(u_texture, texcoords);
    float newg = src_color.z;
    float newb = 0.0;
    if (newg > 0.0)
        newb = 1.0;
    gl_FragColor = vec4(rand_color(newg), 1.0);
}