1#version 430 2 3layout(location = 0) in vec4 in_position; 4layout(location = 1) in vec4 in_color; 5layout(location = 2) in int in_refVertexIndex; 6 7layout(location = 0) out vec4 out_color; 8 9out gl_PerVertex { 10 vec4 gl_Position; 11}; 12 13void main() { 14 vec2 perVertex = vec2(in_position.x, in_position.y); 15 vec2 perInstance[6] = vec2[6](vec2(0.0, 0.0), vec2(0.3, 0.0), vec2(0.0, -0.3),vec2(0.3, -0.3), vec2(0.7, -0.7), vec2(-0.75, 0.8)); 16 17 gl_Position = vec4(perVertex + perInstance[gl_InstanceIndex], 0.0, 1.0); 18 19 if (gl_VertexIndex == in_refVertexIndex) 20 out_color = in_color; 21 else 22 out_color = vec4(1.0, 0.0, 0.0, 1.0); 23} 24