summaryrefslogtreecommitdiff
path: root/gfx/gl/shadowMapper.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-08-19 23:07:12 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2024-08-19 23:07:12 +0100
commit08c9a8ea438f25ae8012d80d2c2c74c799f5543c (patch)
treef762bb030223c923c4ce6c861611cda1f50a8fef /gfx/gl/shadowMapper.cpp
parentUpdate asset stencils from shadow mapper (diff)
downloadilt-08c9a8ea438f25ae8012d80d2c2c74c799f5543c.tar.bz2
ilt-08c9a8ea438f25ae8012d80d2c2c74c799f5543c.tar.xz
ilt-08c9a8ea438f25ae8012d80d2c2c74c799f5543c.zip
Shuffle some GL state setting
Ensures the right things are set at the right times, it's more calls but its less prone to randomly getting screwed over. Also updates the comments about which phases do what.
Diffstat (limited to 'gfx/gl/shadowMapper.cpp')
-rw-r--r--gfx/gl/shadowMapper.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/gfx/gl/shadowMapper.cpp b/gfx/gl/shadowMapper.cpp
index 9b9e404..ff0634e 100644
--- a/gfx/gl/shadowMapper.cpp
+++ b/gfx/gl/shadowMapper.cpp
@@ -77,15 +77,18 @@ ShadowMapper::getBandViewExtents(const Camera & camera, const glm::mat4 & lightV
ShadowMapper::Definitions
ShadowMapper::update(const SceneProvider & scene, const Direction3D & dir, const Camera & camera) const
{
+ glCullFace(GL_FRONT);
+ glEnable(GL_DEPTH_TEST);
+
ShadowStenciller shadowStenciller {dir, up};
for (const auto & [id, asset] : gameState->assets) {
if (const auto r = std::dynamic_pointer_cast<const Renderable>(asset)) {
r->updateStencil(shadowStenciller);
}
}
+
glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);
glClear(GL_DEPTH_BUFFER_BIT);
- glCullFace(GL_FRONT);
glViewport(0, 0, size.x, size.y);
const auto lightViewDir = glm::lookAt({}, dir, up);