BindTexture vs. ActiveTexture

I’m a bit fuzzy on the usage of these. I understand that when setting up textures, you generate them, then bind to one and set parameters and load in graphic data.

When in the main rendering loop, though, can you simply call glActiveTexture() between calls to glDrawElements() or do you have to Bind as well?

If I can through another quick question in as well… I’m calling glGetIntegerv(GL_MAX_TEXTURE_UNITS, &maxtu); and when checking the value of maxtu, it’s only 2. I’m testing this on an Android emulator… What I’m not totally clear on is if what determines what is set here. Is it the Android implementation of OpenGL ES (Which is 1.0 and very little 1.1 functionality) or the hardware (different phones, cpus, etc…)?

glActiveTexture simply selects the texture unit that will be affected by subsequent calls to other calls such as glBindTexture, glTexEnv*, glTexImage*, glTexParameter*, glGetTexEnv*, glGetTexParameter*, glEnable/Disable(GL_TEXTURE_2D), glMatrixMode(GL_TEXTURE).

You can imagine glActiveTexture simply specifying a hidden parameter to all these functions. On its own, it does nothing.

Note there is also glClientActiveTexture, which affects only the calls setting up texture coordinates:
glTexCoordPointer, glClientEnable/Disable(GL_TEXCOORD_ARRAY), glMultiTexCoord4*.

If I can through another quick question in as well… I’m calling glGetIntegerv(GL_MAX_TEXTURE_UNITS, &maxtu); and when checking the value of maxtu, it’s only 2. I’m testing this on an Android emulator… What I’m not totally clear on is if what determines what is set here. Is it the Android implementation of OpenGL ES (Which is 1.0 and very little 1.1 functionality) or the hardware (different phones, cpus, etc…)?

Typically that’s a hardware limitation (unless it’s a software OpenGL ES implementation, obviously).

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.