[vert.glsl]

#version 130

in vec3 in_position;
in vec2 in_texcoord;

uniform mat4 u_projection;
uniform mat4 u_view;
uniform mat4 u_model;

out vec2 pass_texcoord;

void main()
{
    gl_Position = u_projection * u_view * u_model
                * vec4(in_position, 1.0);
    pass_texcoord = in_texcoord;
}

[frag.glsl]

#version 130

#if defined GL_ES
precision mediump float;
#endif

in vec2 pass_texcoord;

uniform sampler2D u_texture;
uniform sampler2D u_palette;
uniform vec2 u_texsize;

void main()
{
    vec4 pal = texture2D(u_texture, pass_texcoord);
    vec4 col = texture2D(u_palette, vec2(pal.x, 0.0));
    if (pal.x == 0.0)
        discard;
    gl_FragColor = col;
}

