Skip to content

Commit f4add5f

Browse files
authored
Fix rlSetUniformSampler (#3759)
Fix rlSetUniformSampler not setting sampler uniform if the same texture was already passed to a different sampler uniform
1 parent 40f3df5 commit f4add5f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/rlgl.h

+8-1
Original file line numberDiff line numberDiff line change
@@ -4135,7 +4135,14 @@ void rlSetUniformSampler(int locIndex, unsigned int textureId)
41354135
{
41364136
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
41374137
// Check if texture is already active
4138-
for (int i = 0; i < RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS; i++) if (RLGL.State.activeTextureId[i] == textureId) return;
4138+
for (int i = 0; i < RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS; i++)
4139+
{
4140+
if (RLGL.State.activeTextureId[i] == textureId)
4141+
{
4142+
glUniform1i(locIndex, 1 + i);
4143+
return;
4144+
}
4145+
}
41394146

41404147
// Register a new active texture for the internal batch system
41414148
// NOTE: Default texture is always activated as GL_TEXTURE0

0 commit comments

Comments
 (0)