From 0cc8a3110c2fe3ee0f9c7e3efad633662d57c77e Mon Sep 17 00:00:00 2001 From: veins1 <19636663+veins1@users.noreply.github.com> Date: Thu, 25 Jan 2024 04:19:38 +0500 Subject: [PATCH] Fix rlSetUniformSampler Fix rlSetUniformSampler not setting sampler uniform if the same texture was already passed to a different sampler uniform --- src/rlgl.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/rlgl.h b/src/rlgl.h index 747025b83..6ad6394d0 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -4135,7 +4135,14 @@ void rlSetUniformSampler(int locIndex, unsigned int textureId) { #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) // Check if texture is already active - for (int i = 0; i < RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS; i++) if (RLGL.State.activeTextureId[i] == textureId) return; + for (int i = 0; i < RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS; i++) + { + if (RLGL.State.activeTextureId[i] == textureId) + { + glUniform1i(locIndex, 1 + i); + return; + } + } // Register a new active texture for the internal batch system // NOTE: Default texture is always activated as GL_TEXTURE0