From 834b9197863beacac779a9a7f72794218536134a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20F=C3=BCndgens?= Date: Fri, 23 Jan 2015 14:22:24 +0100 Subject: [PATCH 1/2] Removed unnecessary bind and clear calls. --- graphics.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/graphics.cc b/graphics.cc index 5722827..7bed6a4 100644 --- a/graphics.cc +++ b/graphics.cc @@ -94,9 +94,7 @@ void Graphics::render() // render each side of the cube for (int i_face = 0; i_face<6; i_face++) { glClear(GL_DEPTH_BUFFER_BIT); - framebuffer_cube->bind(); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i_face, depth_cubeMaps.at(i_pointlight)->getObjectName(), 0); - glClear(GL_DEPTH_BUFFER_BIT); glm::mat4 depthViewProjectionMatrix_face = depthProjectionMatrix_pointlights * glm::lookAt(level->getLights()->at(i_pointlight).getPosition(), level->getLights()->at(i_pointlight).getPosition() + looking_directions[i_face], glm::vec3(0.0f, 1.0f, 0.0f)); level->render(depthShader, false, &depthViewProjectionMatrix_face); From f240572c8ea899e94e53ad4a1662d986b14017fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20F=C3=BCndgens?= Date: Fri, 23 Jan 2015 14:33:04 +0100 Subject: [PATCH 2/2] Fixed a drawing bug for the pointlight shadows. --- graphics.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphics.cc b/graphics.cc index 7bed6a4..4e3534d 100644 --- a/graphics.cc +++ b/graphics.cc @@ -93,8 +93,8 @@ void Graphics::render() for (unsigned int i_pointlight = 0; i_pointlight<1 && i_pointlightgetLights()->size(); i_pointlight++) { // render each side of the cube for (int i_face = 0; i_face<6; i_face++) { - glClear(GL_DEPTH_BUFFER_BIT); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i_face, depth_cubeMaps.at(i_pointlight)->getObjectName(), 0); + glClear(GL_DEPTH_BUFFER_BIT); glm::mat4 depthViewProjectionMatrix_face = depthProjectionMatrix_pointlights * glm::lookAt(level->getLights()->at(i_pointlight).getPosition(), level->getLights()->at(i_pointlight).getPosition() + looking_directions[i_face], glm::vec3(0.0f, 1.0f, 0.0f)); level->render(depthShader, false, &depthViewProjectionMatrix_face);