diff --git a/inferno/src/inferno/render/texture.cpp b/inferno/src/inferno/render/texture.cpp index 4ee7710..f1c14a8 100644 --- a/inferno/src/inferno/render/texture.cpp +++ b/inferno/src/inferno/render/texture.cpp @@ -45,9 +45,15 @@ namespace Inferno { glDeleteTextures(1, &m_id); } - void Texture::bind() const + void Texture::bind(uint32_t unit) const { + // Set active unit + glActiveTexture(GL_TEXTURE0 + unit); + glBindTexture(GL_TEXTURE_2D, m_id); + + // Reset unit + glActiveTexture(GL_TEXTURE0); } void Texture::unbind() const diff --git a/inferno/src/inferno/render/texture.h b/inferno/src/inferno/render/texture.h index 8751144..7f9996b 100644 --- a/inferno/src/inferno/render/texture.h +++ b/inferno/src/inferno/render/texture.h @@ -13,7 +13,7 @@ namespace Inferno { Texture(const std::string& path); virtual ~Texture(); - void bind() const; + void bind(uint32_t unit = 0) const; void unbind() const; inline std::string path() const { return m_path; }