26 lines
837 B
GLSL
26 lines
837 B
GLSL
out vec2 uv;
|
|
|
|
void main() {
|
|
// Calculate vertex position based on gl_VertexID
|
|
vec2 positions[6] = vec2[6](
|
|
vec2(-1.0, 1.0), // Top-left
|
|
vec2( 1.0, 1.0), // Top-right
|
|
vec2( 1.0, -1.0), // Bottom-right
|
|
vec2( 1.0, -1.0), // Bottom-right (repeated)
|
|
vec2(-1.0, -1.0), // Bottom-left
|
|
vec2(-1.0, 1.0) // Top-left (repeated)
|
|
);
|
|
|
|
// Calculate UV coordinates based on gl_VertexID
|
|
vec2 texCoords[6] = vec2[6](
|
|
vec2(0.0, 1.0), // Top-left
|
|
vec2(1.0, 1.0), // Top-right
|
|
vec2(1.0, 0.0), // Bottom-right
|
|
vec2(1.0, 0.0), // Bottom-right (repeated)
|
|
vec2(0.0, 0.0), // Bottom-left
|
|
vec2(0.0, 1.0) // Top-left (repeated)
|
|
);
|
|
|
|
gl_Position = vec4(positions[gl_VertexID], 0.0, 1.0);
|
|
uv = texCoords[gl_VertexID];
|
|
} |