Question about glGenTextures / GLActiveTexture...

So… I know that using BindTexture after GlActiveTexture will bind that texture to whatever texture unit specified as an argument (ie. GL_TEXTURE0 + 2, or whatever…)… but if one doesn’t call GlActiveTexture prior to binding a texture, is an active texture name still silently used in the background?

I ask because I’m doing some work on some already heavily developed code, a little shader work that requires me to make a little GlActiveTexture calling and such, where some textures have already been generated by the time I’ll be making this call and I’m trying to make sure I don’t grab an already taken texture unit…

If I use the id from glGenTextures and add that to GL_TEXTURE0, shouldn’t that guarantee me a free texture? (ie:

	glGenTextures( 1, &id );
        glActiveTexture(GL_TEXTURE0 + id);

that should keep me from having to worry about overwriting any prior texture units, right?

Uwah, you’ve completely misunderstood texture-binding ^^"

glActiveTexture() accepts values of GL_TEXTURE0 up to GL_TEXTURE31. These are the sampler-unit slots. Put textures in two slots, and you have multitexturing.
glGenTextures creates a handle (the “id” or “name”).

glGenTextures(1,&myTex); // myTex=2348972;
glActiveTexture(GL_TEXTURE7); // g_glActiveTexunit=7;
glBindTexture(GL_TEXTURE_2D,myTex); // g_glSamplers2D[7]=myTex;

…ohhhhhhhh. Sooooo… I don’t have to worry about doing some kind of catastrophic damage then. :3 That’s a good thing… makes my life a lot easier. =)