From 2381fe08be1a0c99d9541761b85064b8ece3f253 Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 29 Oct 2021 18:48:10 +0800 Subject: +md5 --- Runtime/Graphics/GfxDevice.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Runtime/Graphics/GfxDevice.cpp') 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); } -- cgit v1.1-26-g67d0