summary refs log tree commit diff
path: root/shaders
diff options
context:
space:
mode:
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;
 }