summaryrefslogtreecommitdiff
path: root/Runtime/Graphics/GfxDevice.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Runtime/Graphics/GfxDevice.cpp')
-rw-r--r--Runtime/Graphics/GfxDevice.cpp2
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);
}