glbindtexture

How do I use glBindTexture? - all the source code I can find is hopelessly unreadable and the OpenGL help file I have skips over most of it conveniantly. Simple examples preferred with some doc. if poss

After you first loaded a texture in opengl and assigned a number to it(using glGenTextures or else) you call glBindTexture(GL_TEXTURE_*, NUMBER_OF_YOUR_TEXTURE).
(the * stand for 1D, 2D, 3D

This will make your texture object active or “waiting to be called”.

example :

struct{
GLuint texnum;
//other texture info
} texture;

texture texobj[MAX_TEX_OBJECT]

//create texture one
glGenTexture(1,texobj[0].texnum);
//Set color in filter and etc.
glBindTexture(texobj[0].texnum);

//create the other textures with the same template.

After, when you get to the actual scene rendering and want to render using the first texture you call glBindTexture again(this time it will says to opengl use that texture for the next textures mapping if the number you pass to glBindTexture is one that has an active texture(that mean you already called glBind for it)).

glBindTexture(GL_TEXTURE_*, texobj[0]);
//render stuff that use the first texture

glBindTexture(GL_TEXTURE_*, texobj[1];
//render stuff using the second texture.