From 71c65522581c48cb63ce0355d1fcc68abf32f9a2 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Thu, 30 Jun 2022 23:59:37 +0200 Subject: [PATCH] Prepare the vertex shader to draw without a vertex buffer --- src/lightmap/glsl_vert.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lightmap/glsl_vert.h b/src/lightmap/glsl_vert.h index 1d61ded..d526320 100644 --- a/src/lightmap/glsl_vert.h +++ b/src/lightmap/glsl_vert.h @@ -20,10 +20,17 @@ layout(push_constant) uniform PushConstants layout(location = 0) out vec3 worldpos; +vec2 positions[4] = vec2[]( + vec2(0.0, 0.0), + vec2(0.0, 1.0), + vec2(1.0, 1.0), + vec2(1.0, 0.0) +); + void main() { worldpos = vec3(0.0); - gl_Position = vec4(0.0, 0.0, 0.0, 1.0); + gl_Position = vec4(positions[gl_VertexIndex] * 2.0 - 1.0, 0.0, 1.0); } )glsl";