glGenerateMipmap(target);
}
-void TextureGL::bind()
+void TextureGL::bind(int texture_unit)
{
+ glActiveTexture(GL_TEXTURE0 + texture_unit);
+
unsigned int target = is_cubemap() ? GL_TEXTURE_CUBE_MAP : GL_TEXTURE_2D;
glBindTexture(target, tex);
+
+ //TODO: (not needed for now) if I ever use textures outside the Texture class
+ //glActiveTexture(GL_TEXTURE0);
+}
+
+void TextureGL::unbind()
+{
+ unsigned int target = is_cubemap() ? GL_TEXTURE_CUBE_MAP : GL_TEXTURE_2D;
+ glBindTexture(target, 0);
}
\ No newline at end of file