diff options
author | chai <chaifix@163.com> | 2021-10-29 18:48:10 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-10-29 18:48:10 +0800 |
commit | 2381fe08be1a0c99d9541761b85064b8ece3f253 (patch) | |
tree | 5f04464b7c2ebf3d718b61e959d23f903dd4c6b0 /Runtime/Graphics/GfxDevice.cpp | |
parent | 796b4b05ec62eb5d58a634854998f485072e8a2b (diff) |
+md5
Diffstat (limited to 'Runtime/Graphics/GfxDevice.cpp')
-rw-r--r-- | Runtime/Graphics/GfxDevice.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Runtime/Graphics/GfxDevice.cpp b/Runtime/Graphics/GfxDevice.cpp index bd8dd9d..d466eb9 100644 --- a/Runtime/Graphics/GfxDevice.cpp +++ b/Runtime/Graphics/GfxDevice.cpp @@ -132,10 +132,12 @@ void GfxDevice::SetUniformTexture(const char* name, Texture* texture) log_error("No available texture unit. Too many textures or forget invoke ResetUniformsState()"); return; } + int texUnit = s_AvailableTextureUnit.back(); s_AvailableTextureUnit.pop_back(); glActiveTexture(GL_TEXTURE0 + texUnit);
glBindTexture(GL_TEXTURE_2D, texture->GetGpuID());
+
GLint loc = glGetUniformLocation(m_Shader.GetID(), name); glUniform1i(loc, texUnit); } |