vectors are now passed to the gpu instead of being embedded to the shader

This commit is contained in:
Luna 2025-04-24 04:13:58 +02:00
parent 9029dd50ae
commit 619f4a2641
5 changed files with 91 additions and 25 deletions

View file

@ -1,9 +1,9 @@
#version 450
layout(location = 0) in vec3 in_color;
layout(location = 0) in vec3 frag_color;
layout(location = 0) out vec4 out_color;
void main()
{
out_color = vec4(in_color, 1.0);
out_color = vec4(frag_color, 1.0);
}

Binary file not shown.

Binary file not shown.

View file

@ -3,22 +3,13 @@
// x -> -1 (left) 1(right)
// y -> -1 (top) 1(bottom)
vec2 positions[3] = vec2[](
vec2(0.0, -0.5),
vec2(0.5, 0.5),
vec2(-0.5, 0.5)
);
layout(location = 0) in vec2 in_position;
layout(location = 1) in vec3 in_color;
vec3 colors[3] = vec3[](
vec3(1.0, 0.0, 0.0),
vec3(0.0, 1.0, 0.0),
vec3(0.0, 0.0, 1.0)
);
layout(location = 0) out vec3 in_color;
layout(location = 0) out vec3 frag_color;
void main()
{
gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0);
in_color = colors[gl_VertexIndex];
gl_Position = vec4(in_position, 0.0, 1.0);
frag_color = in_color;
}