2019-09-26 16:07:30 +10:00
|
|
|
#version 450
|
|
|
|
|
|
|
|
out gl_PerVertex {
|
|
|
|
vec4 gl_Position;
|
|
|
|
};
|
|
|
|
|
2019-10-03 13:22:20 +10:00
|
|
|
layout(location = 0) out vec2 v_TexCoord;
|
|
|
|
|
|
|
|
const vec2 positions[6] = vec2[6](
|
|
|
|
// Upper left triangle
|
|
|
|
vec2(-1.0, -1.0),
|
|
|
|
vec2(1.0, -1.0),
|
|
|
|
vec2(-1.0, 1.0),
|
|
|
|
|
|
|
|
// Lower right triangle
|
|
|
|
vec2(-1.0, 1.0),
|
|
|
|
vec2(1.0, -1.0),
|
|
|
|
vec2(1.0, 1.0)
|
|
|
|
);
|
|
|
|
|
|
|
|
const vec2 uv[6] = vec2[6](
|
|
|
|
// Upper left triangle
|
|
|
|
vec2(0.0, 0.0),
|
|
|
|
vec2(1.0, 0.0),
|
|
|
|
vec2(0.0, 1.0),
|
|
|
|
|
|
|
|
// Lower right triangle
|
|
|
|
vec2(0.0, 1.0),
|
|
|
|
vec2(1.0, 0.0),
|
|
|
|
vec2(1.0, 1.0)
|
2019-09-26 16:07:30 +10:00
|
|
|
);
|
|
|
|
|
|
|
|
void main() {
|
2019-10-03 13:22:20 +10:00
|
|
|
v_TexCoord = uv[gl_VertexIndex];
|
2019-09-26 16:07:30 +10:00
|
|
|
gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0);
|
|
|
|
}
|