I'm stumped!

Hey again. This time i’m having trouble dynamically loading textures to use. I have a dynamic array name ‘textures’ of type GLuint that is resized depending on the value of a number in a text file. I want the program i’m making to loop as many number of times that the number specifies, calling the function below and loading a different bitmap into each of the array’s elements. However, that’s not happening at all. It’s not giving me an error, but when i try to map a polygon, i get no image at all.

Here’s the code i’m using to load a bitmap into an array element specified as ‘thetexture’…

void LoadTexture(const char* filename, GLuint &thetexture)
{
AUX_RGBImageRec *temp; // Used to store a description of the bitmap.

ZeroMemory(&temp,sizeof(temp)); // Set temp to all zeros!

temp = auxDIBImageLoad(filename);	// Load the bitmap!

glGenTextures(1,&thetexture);	// Generate the texture.

glBindTexture(GL_TEXTURE_2D, thetexture); // Bind the texture.

// Create the texture!
glTexImage2D(GL_TEXTURE_2D, 0, 3, temp->sizeX, temp->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, temp->data);

// Set filtering flags.
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);

if (temp)	// clean up!
{
	if (temp->data)
	{
		free(temp->data);
	}
	free(temp);
}

glBindTexture(GL_TEXTURE_2D,GL_NONE);

}

I call the function like this:

LoadTexture(path,textures[x]);

Thanks…!

can I see your display function
(bottom line are you remember to rebind the textures before drawing the polygons)

and

did you remember to enter
at init
glEnable(GL_TEXTURE_2D);

Yes, i rebinded the textures as well as enabled texture mapping…