I'm finding a way to understand why glActiveTexture
is needed. I have the code below:
glGenTextures(1, &textureId);
glBindTexture(GL_TEXTURE_2D, textureId);
If I imagine that the GL_TEXTURE_2D
is a picture's frame hanging on the wall and textureId
is the real picture, the glBindTexture
is the only command for assigning a real picture to the frame, so, what are GL_TEXTURE0
and glActiveTexture
?
Will my code below work fine?
glActiveTexture(GL_TEXTURE0);
glGenTextures(1, &textureId);
glBindTexture(GL_TEXTURE_2D, textureId);
glActiveTexture(GL_TEXTURE1);
glTexImage2D(GL_TEXTURE_2D, .....)
glTexParameteri(GL_TEXTURE_2D, ...)
I'm currently working with OpenGL2.1.