summary refs log tree commit diff
path: root/shaders
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2026-07-09 21:26:44 -0700
committerIrene Knapp <ireneista@irenes.space>2026-07-09 21:26:44 -0700
commitcd3b77fea9307d9c15718a9e5e17035f7e71ac25 (patch)
treef6cc1020ba2e871408d93bd45f51cfa3eb9b1809 /shaders
parentee29403c132f4ba0babf27639f2a63299de7edca (diff)
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
Diffstat (limited to 'shaders')
-rw-r--r--shaders/shader.vert10
1 files changed, 6 insertions, 4 deletions
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;
 }