Got the triangle working! It only took 10 hours.

This commit is contained in:
Zed A. Shaw 2025-12-14 10:19:24 -05:00
parent 3d36517b4f
commit 10fc100e2b
11 changed files with 352 additions and 4 deletions

24
colored_triangle.vert Normal file
View file

@ -0,0 +1,24 @@
#version 450
layout (location = 0) out vec3 outColor;
void main()
{
//const array of positions for the triangle
const vec3 positions[3] = vec3[3](
vec3(1.f,1.f, 0.0f),
vec3(-1.f,1.f, 0.0f),
vec3(0.f,-1.f, 0.0f)
);
//const array of colors for the triangle
const vec3 colors[3] = vec3[3](
vec3(1.0f, 0.0f, 0.0f), //red
vec3(0.0f, 1.0f, 0.0f), //green
vec3(00.f, 0.0f, 1.0f) //blue
);
//output the position of each vertex
gl_Position = vec4(positions[gl_VertexIndex], 1.0f);
outColor = colors[gl_VertexIndex];
}