#version 330
out vec4 outputColor;

in vec2 texCoord;
in vec4 color;

uniform bool singleChanneled;
uniform bool flipped;
uniform bool textured;
uniform sampler2D texture0;

void main()
{
    float yVal = texCoord.y;
    if (flipped) {
        yVal = 1 - texCoord.y;
    }
    if (textured) {
        if (singleChanneled) {
            outputColor = vec4(color.xyz, texture(texture0, vec2(texCoord.x, yVal)).r);
        } else {
            outputColor = texture(texture0, vec2(texCoord.x, yVal)) * color;
        }
    } else {
        outputColor = color;
    }
}