vulkan_test_simple
annotate vertex.glsl @ 1:d5a3f6912f4d
how the hell did this work?
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 12 Sep 2024 04:19:14 +0300 |
parents | |
children |
rev | line source |
---|---|
nuclear@0 | 1 #version 450 |
nuclear@0 | 2 #extension GL_ARB_separate_shader_objects : enable |
nuclear@0 | 3 |
nuclear@0 | 4 out gl_PerVertex { |
nuclear@0 | 5 vec4 gl_Position; |
nuclear@0 | 6 }; |
nuclear@0 | 7 |
nuclear@0 | 8 layout(location = 0) out vec3 color; |
nuclear@0 | 9 |
nuclear@0 | 10 vec2 vpos[3] = vec2[]( |
nuclear@0 | 11 vec2(0.0, -0.5), |
nuclear@0 | 12 vec2(0.5, 0.5), |
nuclear@0 | 13 vec2(-0.5, 0.5) |
nuclear@0 | 14 ); |
nuclear@0 | 15 |
nuclear@0 | 16 vec3 vcol[3] = vec3[]( |
nuclear@0 | 17 vec3(1.0, 0.0, 0.0), |
nuclear@0 | 18 vec3(0.0, 1.0, 0.0), |
nuclear@0 | 19 vec3(0.0, 0.0, 1.0) |
nuclear@0 | 20 ); |
nuclear@0 | 21 |
nuclear@0 | 22 void main() |
nuclear@0 | 23 { |
nuclear@0 | 24 gl_Position = vec4(vpos[gl_VertexIndex], 0.0, 1.0); |
nuclear@0 | 25 color = vcol[gl_VertexIndex]; |
nuclear@0 | 26 } |