I'm using OpenGL 4.30 with JOGL (in Java). I'm playing with basic texturing, trying to learn how it's done.
The textbook I'm using has the following code:
gl.glActiveTexture(GL_TEXTURE0); // is this line necessary?
gl.glBindTexture(GL_TEXTURE_2D, textureID);
gl.glDrawArrays(GL_TRIANGLES, 0, 3);
This works well enough. But I find that if I comment out the first line, that it appears to have absolutely no effect on my program. So what is its point? Can the GPU only hold a limited number of textures at once, and I'm using #0 to hold the texture referred to by textureID
? If I keep reusing the same constant GL_TEXTURE0
for all of my textures, does that mean that I'm slowing everything down? Or is this just to support legacy code, and I don't need to call this function at all? I'm very confused as to why this line is needed, and what it's doing.