improved GL texture binding api to take texture units into consideration

This commit is contained in:
Alexander Szpakowski
2012-12-21 20:35:32 -04:00
parent 5626b74b79
commit 16f925affa
5 changed files with 98 additions and 18 deletions
+3 -3
View File
@@ -332,12 +332,12 @@ void ShaderEffect::sendTexture(const std::string &name, GLuint texture)
GLint texture_unit = getTextureUnit(name);
glActiveTexture(GL_TEXTURE0 + texture_unit);
bindTexture(texture, true); // guarantee it gets bound
setActiveTextureUnit(GL_TEXTURE0 + texture_unit);
bindTexture(texture);
glUniform1i(location, texture_unit);
// reset texture unit
glActiveTexture(GL_TEXTURE0);
setActiveTextureUnit(GL_TEXTURE0);
// throw error if needed
checkSetUniformError();