feat: ambient lighting

This commit is contained in:
Cat Flynn 2023-08-03 08:43:34 +02:00
parent ef67495aef
commit abb990b9d4
2 changed files with 8 additions and 4 deletions

View File

@ -4,5 +4,12 @@ out vec4 FragColor;
void main()
{
FragColor = vec4(1.0, 0.5, 0.2, 1.0);
vec3 objectColor = vec3(1.0, 0.5, 0.2);
vec3 lightColor = vec3(1.0, 1.0, 1.0);
float ambientStrength = 0.1;
vec3 ambient = ambientStrength * lightColor;
vec3 result = ambient * objectColor;
FragColor = vec4(ambient, 1.0);
}

View File

@ -130,9 +130,6 @@ int main()
GLuint shaderProgram = compileShaderProgram();
Icosphere sphere(2);
// Wireframe
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
// Main loop
while (!glfwWindowShouldClose(window))
{