It can be simply understood as: There are n texture units in the graphics card (the number depends on your graphics card capabilities), each texture unit (GL_TEXTURE0, GL_TEXTURE1, etc.) have gl_texture_1d, gl_texture_2d, and so on, the following code:
struct Textureunit
{
gluint targettexture1d;
Gluint targettexture2d;
Gluint Targettexture3d;
Gluint Targettexturecube;
...
};
Textureunit Textureunits[gl_max_texture_image_units]
gluint currenttextureunit = 0;
By default, the currently active texture unit is 0.
void Glactivetexture (Glenum textureunit)
{
currenttextureunit = textureunit -gl_texture0;
}
Instead of activating the texture unit, Glactivetextue selects the currently active texture cell.
void Glbindtexture (Glenum texturetarget, Gluint textureobject)
{
Textureunit *texunit = &textureunits[ Currenttextureunit];
Switch (texturetarget)
{case
gl_texture_1d:texunit->targettexture1d = textureobject;
Case gl_texture_2d:texunit->targettexture2d = Textureobject; break;
Case Gl_texture_3d:texunit->targettexture3d = Textureobject; break;
Case gl_texture_cubemap:texunit->targettexturecube = Textureobject; break;
}
}
As you can see from the sample code: When you bind a texture target, it is the currently active texture cell.