From cd3b77fea9307d9c15718a9e5e17035f7e71ac25 Mon Sep 17 00:00:00 2001 From: Irene Knapp Date: Thu, 9 Jul 2026 21:26:44 -0700 Subject: allocate and use a vertex buffer kinda cool how the driver interfaces with the kernel to map memory on our behalf Force-Push: yes Change-Id: I906f68b59dcedc1fd6d9bfc52c9b299abc9cd828 --- shaders/shader.vert | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'shaders/shader.vert') diff --git a/shaders/shader.vert b/shaders/shader.vert index 186ba52..d53ef0a 100644 --- a/shaders/shader.vert +++ b/shaders/shader.vert @@ -1,5 +1,9 @@ #version 460 +layout(location = 0) in vec2 inPosition; +layout(location = 1) in vec3 inColor; +layout(location = 0) out vec3 vertexColor; + vec2 triangle[3] = vec2[]( vec2(0.0, -0.5), vec2(0.5, 0.5), @@ -12,10 +16,8 @@ vec3 colors[3] = vec3[]( vec3(0.0, 0.0, 1.0) ); -layout(location = 0) out vec3 vertexColor; - void main() { - gl_Position = vec4(triangle[gl_VertexIndex], 0.0, 1.0); - vertexColor = colors[gl_VertexIndex]; + gl_Position = vec4(inPosition, 0.0, 1.0); + vertexColor = inColor; } -- cgit 1.4.1