I see in a GL 2.1 shaderless program using two textures that they are bound
Particularly, no glActiveTexture() command, which I guess means by default glActiveTexture(GL_TEXTURE0).
However, a similar GL4.3 program using shaders clearly requires
glActiveTexture(GL_TEXTURE0) before binding the first texture and then
glActiveTexture(GL_TEXTURE1) before binding the next.
Why the apparent difference in treatment between GL 2.1 and 4.3?
Thanks in advance,
They’re doing different things.
The point in the 2.1 code where you’re seeing those bind texture calls is doing texture setup work. They’re not rendering with them yet. You’ll see similar code in 4.3 code.
The place where you’re seeing active-texture calls before binding is for rendering. And you’ll see that same code for any non-shader program that uses more than one texture on an object.
Thanks, Alfonse. But I must be missing something. There is no glActiveTexture(GL_TEXTURE1) call anywhere in the non-shader program though it applies two 2D textures to the scene drawn. In fact, there is no glActiveTexture() call at all anywhere in the code. Shouldn’t there be?
(Btw, there’s a typo in my first post: that should be glBindTexture(GL_TEXTURE_2D, texture) in the second statement block).
It’s probably using some multi-pass technique, as opposed to a multi-texturing approach. If you check closer, you’ll probably see it draws the same object multiple times, applying one texture at a time and using blending to add to what already exists in the frame buffer, rather than applying multiple textures to the object in one go.