c++openglopengl-4

How do I get glBindTextureUnit() to work?


The following works fine:

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, m_ID);

But when I replace it with this, it doesn't work. (I don't get any errors, just a black color instead of the texture):

glBindTextureUnit(GL_TEXTURE0, m_ID);

From what I searched online I can't see what I'm doing wrong, so I'm not sure how to troubleshoot this.


Solution

  • glBindTextureUnit does not take OpenGL texture unit enumerators like GL_TEXTURE0. It takes texture unit indices, like 0.