Skip to content

Commit

Permalink
fix: models when not lit
Browse files Browse the repository at this point in the history
  • Loading branch information
JulioJPinto committed May 20, 2024
1 parent d8a7640 commit 606058a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions engine/src/light.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ void setupMaterial(Material m) {

void setupLights(std::vector<Light> lights) {
if (lights.size() != 0) {
glEnable(GL_RESCALE_NORMAL);
float amb[4] = {1.0f, 1.0f, 1.0f, 1.0f};

glLightModelfv(GL_LIGHT_MODEL_AMBIENT, amb);
Expand Down
7 changes: 3 additions & 4 deletions engine/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ void drawAxis(void) {

glColor3f(1.0f, 1.0f, 1.0f);
glEnd();
glEnable(GL_LIGHTING);
if(c.lights.size() != 0) {
glEnable(GL_LIGHTING);
}
}
}

Expand Down Expand Up @@ -247,13 +249,10 @@ int main(int argc, char** argv) {
// some OpenGL settings
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glEnable(GL_RESCALE_NORMAL);
setupLights(c.lights);

// enter GLUT�s main cycle
glutMainLoop();

// shutDownMenu();

return 1;
}

0 comments on commit 606058a

Please sign in to comment.