Problem using multiple textures...

Hi everyone,

For a game, I am using multiple textures.

Thing is, since I have 6 textures, I have display bugs… For example texture 6 applies where there is a glBindTexture for the fourth one…

I had no bugs with 5 textures, but since I have 6, the right textures don’t apply like they should anymore.

Does anyone have a clue?

Thank you already !

Creation of a texture

void load_texture_1(GLuint texture){
	glEnable(GL_TEXTURE_2D);

	glBindTexture(GL_TEXTURE_2D, texture);

	glEnable(GL_BLEND);
  	glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

  	glGenTextures(1, &texture);

	glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE , GL_MODULATE);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);

    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

    gluBuild2DMipmaps(GL_TEXTURE_2D, pik.bytes_per_pixel, pik.width, pik.height, GL_RGBA,              GL_UNSIGNED_BYTE, pik.pixel_data);

    glDisable(GL_TEXTURE_2D);
    glDeleteTextures(1, &texture);
}

Using the texture BUT it uses textures[5] instead of textures[3] ! It doesn’t make sense, since I am binding textures[3] for the subsequent drawing…

void drawCircle(){

	glColor4f(1, 1, 1, 1);
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, textures[3]);

	glBegin(GL_QUADS);
   		glTexCoord2d(0.0, 1.0); glVertex2i(0.0,38.0);
    	glTexCoord2d(0.0, 0.0); glVertex2i(0.0,0.0);
    	glTexCoord2d(1.0, 0.0); glVertex2i(38.0,0.0);
    	glTexCoord2d(1.0, 1.0); glVertex2i(38.0,38.0);
   	glEnd();

   	
   	glDisable(GL_TEXTURE_2D);
   	
}