diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-10-30 17:08:59 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-10-30 17:08:59 +0000 |
commit | d63f393b7bcabd7f6569b87a2dedbc8333c47554 (patch) | |
tree | a34b8f2cb32381f912f85d9cd6fb2c0dfd8a3e6f /gfx/models | |
parent | EditNetworkOf constructor may have single param, should be explicit (diff) | |
download | ilt-d63f393b7bcabd7f6569b87a2dedbc8333c47554.tar.bz2 ilt-d63f393b7bcabd7f6569b87a2dedbc8333c47554.tar.xz ilt-d63f393b7bcabd7f6569b87a2dedbc8333c47554.zip |
Setting texture unit on bind
Always sets the target unit before binding, allows specifying the unit
Diffstat (limited to 'gfx/models')
-rw-r--r-- | gfx/models/texture.cpp | 3 | ||||
-rw-r--r-- | gfx/models/texture.h | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/gfx/models/texture.cpp b/gfx/models/texture.cpp index 60e4045..ab04f4f 100644 --- a/gfx/models/texture.cpp +++ b/gfx/models/texture.cpp @@ -31,7 +31,8 @@ Texture::Texture(GLsizei width, GLsizei height, const void * data) }
void
-Texture::Bind() const
+Texture::bind(GLenum unit) const
{
+ glActiveTexture(unit);
glBindTexture(GL_TEXTURE_2D, m_texture);
}
diff --git a/gfx/models/texture.h b/gfx/models/texture.h index c3deb7b..2bbf1f4 100644 --- a/gfx/models/texture.h +++ b/gfx/models/texture.h @@ -15,7 +15,7 @@ public: static Cache<Texture, std::filesystem::path> cachedTexture;
- void Bind() const;
+ void bind(GLenum unit = GL_TEXTURE0) const;
private:
glTexture m_texture;
|