diff options
| author | veins1 <[email protected]> | 2024-01-28 17:45:19 +0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-01-28 13:45:19 +0100 |
| commit | f4add5f10d38c4f3fb3aa748423773f3de18b420 (patch) | |
| tree | 4c1f3478ed7a2a4d74ad2421c7988ddce9c5fbab /src | |
| parent | 40f3df5b865eee0cd87a9e4e1347cb04c87841f8 (diff) | |
| download | raylib-f4add5f10d38c4f3fb3aa748423773f3de18b420.tar.gz raylib-f4add5f10d38c4f3fb3aa748423773f3de18b420.zip | |
Fix rlSetUniformSampler (#3759)
Fix rlSetUniformSampler not setting sampler uniform if the same texture was already passed to a different sampler uniform
Diffstat (limited to 'src')
| -rw-r--r-- | src/rlgl.h | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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 |
