Original Post
Hey guys-n-gals,
I am trying to do some OGL programming and have come accross a hurdle.
I am trying to load in multiple textures but am having trouble. Below is the modified code from the tutorial20.
When I run the program, it just crashes.
//-------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------
int LoadGLTextures(char *Filename, int num) // Load Bitmaps And Convert To Textures
{
if (num>MAXTEXTURES)
{
return NULL;
}
int Status=FALSE; // Status Indicator
AUX_RGBImageRec *TextureImage[1]; // Create Storage Space For The Texture Data
memset(TextureImage,0,sizeof(void *)*1); // Set The Pointer To NULL
if (TextureImage[1]=LoadBMP(Filename)) // Texture to load
{
Status=TRUE; // Set The Status To TRUE
glGenTextures(1, &texture[num]); // Create Texture
glBindTexture(GL_TEXTURE_2D, texture[num]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[1]->sizeX, TextureImage[1]->sizeY,
0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[1]->data);
}
if (TextureImage[1]) // If Texture Exists
{
if (TextureImage[1]->data) // If Texture Image Exists
{
free(TextureImage[1]->data); // Free The Texture Image Memory
}
free(TextureImage[1]); // Free The Image Structure
}
return Status; // Return The Status
}
//-------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------
Any ideas??
Thanks!
-zebes
zebes@mindspring.com