#version 330 core

uniform mat4 u_MVP;

layout(location = 0) in  vec3 in_pos;
layout(location = 3) in  vec4 in_color;
layout(location = 8) in  vec2 in_texcoord;

out vec4 vColor;
out vec2 vTexCoord;

void main(void) {
    
    gl_Position = u_MVP * vec4(in_pos, 1.0);
    
	vColor = in_color;
    
    // in_texcoord is defined with (0,0) at top-left (same as in_pos)
    // however, sampling in OpenGL expects bottom-left. So we must flip Y.
	vTexCoord = vec2(in_texcoord.x, 1.0 - in_texcoord.y);
}
