Add setting texture unit in bind()
This commit is contained in:
@@ -45,9 +45,15 @@ namespace Inferno {
|
|||||||
glDeleteTextures(1, &m_id);
|
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);
|
glBindTexture(GL_TEXTURE_2D, m_id);
|
||||||
|
|
||||||
|
// Reset unit
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Texture::unbind() const
|
void Texture::unbind() const
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Inferno {
|
|||||||
Texture(const std::string& path);
|
Texture(const std::string& path);
|
||||||
virtual ~Texture();
|
virtual ~Texture();
|
||||||
|
|
||||||
void bind() const;
|
void bind(uint32_t unit = 0) const;
|
||||||
void unbind() const;
|
void unbind() const;
|
||||||
|
|
||||||
inline std::string path() const { return m_path; }
|
inline std::string path() const { return m_path; }
|
||||||
|
|||||||
Reference in New Issue
Block a user