GL shader vertex color variable.

This commit is contained in:
Fries 2024-03-31 20:07:46 -07:00
parent 7c694988d3
commit f5f08ce669

View file

@ -11,9 +11,11 @@ const char* vertexShaderCode = R"(
// Set the GLSL version to 3.3 and use the OpenGL core profile // Set the GLSL version to 3.3 and use the OpenGL core profile
#version 330 core #version 330 core
layout (location = 0) in vec3 aPos; layout (location = 0) in vec3 aPos;
out vec4 vertexColor;
void main() { void main() {
gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0); gl_Position = vec4(aPos, 1.0);
vertexColor = vec4(0.5, 0.0, 0.0, 1.0);
} }
)"; )";
@ -21,9 +23,10 @@ const char* fragmentShaderCode = R"(
// Set the GLSL version to 3.3 and use the OpenGL core profile // Set the GLSL version to 3.3 and use the OpenGL core profile
#version 330 core #version 330 core
out vec4 FragColor; out vec4 FragColor;
in vec4 vertexColor;
void main() { void main() {
FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f); FragColor = vertexColor;
} }
)"; )";