summaryrefslogtreecommitdiff
path: root/gfx/gl/shadowStenciller.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2026-03-08 16:02:56 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2026-03-08 16:02:56 +0000
commit00fc3cb9b2c06026fab0e4760609fe02e027b6df (patch)
treeb84b527824ac1d5c999fc4a974fcf2c356b422ab /gfx/gl/shadowStenciller.cpp
parentReplace gl_traits glTexParameter with glTexture::parameter DSA wrapper (diff)
downloadilt-00fc3cb9b2c06026fab0e4760609fe02e027b6df.tar.bz2
ilt-00fc3cb9b2c06026fab0e4760609fe02e027b6df.tar.xz
ilt-00fc3cb9b2c06026fab0e4760609fe02e027b6df.zip
Move all low level texture operations to DSA helpers in glTexture
Diffstat (limited to 'gfx/gl/shadowStenciller.cpp')
-rw-r--r--gfx/gl/shadowStenciller.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/gfx/gl/shadowStenciller.cpp b/gfx/gl/shadowStenciller.cpp
index a5f9d68..cafae02 100644
--- a/gfx/gl/shadowStenciller.cpp
+++ b/gfx/gl/shadowStenciller.cpp
@@ -37,22 +37,19 @@ ShadowStenciller::getLightDirection() const
}
void
-ShadowStenciller::configureStencilTexture(glTexture & stencil, GLsizei width, GLsizei height)
+ShadowStenciller::configureStencilTexture(glTexture<GL_TEXTURE_2D_ARRAY> & stencil, ImageDimensions size)
{
- stencil.bind(GL_TEXTURE_2D_ARRAY);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
+ stencil.storage(1, GL_DEPTH_COMPONENT16, size || STENCIL_ANGLES<GLsizei>);
stencil.parameter(GL_TEXTURE_MIN_FILTER, GL_LINEAR);
stencil.parameter(GL_TEXTURE_MAG_FILTER, GL_LINEAR);
stencil.parameter(GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
stencil.parameter(GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_DEPTH_COMPONENT, width, height, STENCIL_ANGLES<GLint>, 0,
- GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, nullptr);
}
void
-ShadowStenciller::renderStencil(const glTexture & stencil, const MeshBase & mesh, const Texture::AnyPtr texture) const
+ShadowStenciller::renderStencil(
+ const glTexture<GL_TEXTURE_2D_ARRAY> & stencil, const MeshBase & mesh, const Texture::AnyPtr texture) const
{
glDebugScope _ {fbo};
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
@@ -61,7 +58,7 @@ ShadowStenciller::renderStencil(const glTexture & stencil, const MeshBase & mesh
throw std::runtime_error("Stencil framebuffer not complete!");
}
if (texture) {
- texture->bind();
+ texture->bind(0);
}
glUseProgram(shadowCaster);
glClear(GL_DEPTH_BUFFER_BIT);