X-Git-Url: http://git.mutantstargoat.com?a=blobdiff_plain;f=src%2Fopengl%2Ftexture-gl.cc;h=80db3ad137052de3b88d1d678a09bd7428643886;hb=c3d7c1b7f8a7f4bcfc7661b6baf166ce0648083a;hp=2fbd05ebb8be1a9b683cf3553f20a1e097259e0f;hpb=15cb9e608f3028a86ed878d726f1633bce9d6e04;p=demo diff --git a/src/opengl/texture-gl.cc b/src/opengl/texture-gl.cc index 2fbd05e..80db3ad 100644 --- a/src/opengl/texture-gl.cc +++ b/src/opengl/texture-gl.cc @@ -56,8 +56,19 @@ void TextureGL::update() 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