From 00fc3cb9b2c06026fab0e4760609fe02e027b6df Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 8 Mar 2026 16:02:56 +0000 Subject: Move all low level texture operations to DSA helpers in glTexture --- gfx/gl/shadowStenciller.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'gfx/gl/shadowStenciller.cpp') 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 & stencil, ImageDimensions size) { - stencil.bind(GL_TEXTURE_2D_ARRAY); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - + stencil.storage(1, GL_DEPTH_COMPONENT16, size || STENCIL_ANGLES); 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, 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 & 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); -- cgit v1.3