Ok, let’s start over. Graphics hardware has something called “texture units” or “texture mapping units”, which to my knowledge act(ed) as dedicated processing elements handling, for example, texture filtering, decompression etc. The amount of texture units per GPU is finite. OpenGL 4 capable hardware is required to provide at least 80 units.
Check out http://www.opengl.org/sdk/docs/man4/xhtml/glActiveTexture.xml
Then there’s the concept of “texture objects” in OpenGL. Basically it’s a regular buffer holding some defined amount of data. Usually when it comes to textures this data comprises of values interpreted as color. What you get when callin glGenTextures() is one or a number of handles which uniquely identify a texture object.
At least with OpenGL you can have one texture object bound to one texture unit. The symbolic constants GL_TEXTUREi refer to a specific “texture unit”. OpenGL maintains one active texture unit as the current state. So, if you want to change the texture a texture unit is working on, you will have to tell OpenGL which unit and which texture.
Therefore you do the following:
// here you select a texture unit - in this case it's unit 0
glActiveTexture(GL_TEXTURE0);
// now you bind a specific texture object to unit 0
glBindTexture(GL_TEXTURE_2D, tex_object);
// oops, unit didn't change so tex_object2 is now bound
glBindTexture(GL_TEXTURE_2D, tex_object2);
// for use in shader you associate a texture unit and uniform sampler -
// location named "NormalMap" will now use unit 0 which samples the texture
// defined in tex_object2
glUniform1i("NormalMap", 0);
No, kind of the other way around. Only one texture can be bound to a specific texture unit at a time. You can bind the same texture to multiple units, although probably not useful in most cases.
Now you can probably answer this yourself but I’ll do it anyway. No, the textures are arbitrary, but in the case of a skybox, which can be implemented using 6 differently oriented planes with 6 different textures, you can use a single texture unit.
glActiveTexture(GL_TEXTURE0);
// bind first texture
// render first plane
// bind second texture
// render second plane
// an so forth ...
HTH.