int LoadGLTextures()
{
int Status=FALSE, queue=0;
AUX_RGBImageRec *TextureImage[20]; // Create Storage Space For The Texture
memset(TextureImage,0,sizeof(void *)*1);
//Load the bitmaps for the cubes on the screen
TextureImage[0]=LoadBMP("cube.bmp"); //First cube
TextureImage[1]=LoadBMP("NEHE.bmp"); //Second cube
TextureImage[2]=LoadBMP("NEHE.bmp"); //Third cube
TextureImage[3]=LoadBMP("cube4.bmp");//Fourth cube
TextureImage[4]=LoadBMP("NEHE.bmp"); //Fifth cube
TextureImage[5]=LoadBMP("NEHE.bmp"); //Sixth cube
TextureImage[6]=LoadBMP("NEHE.bmp"); //Seventh cube
TextureImage[7]=LoadBMP("NEHE.bmp"); //Eighth cube
TextureImage[8]=LoadBMP("NEHE.bmp"); //Ninth cube
TextureImage[9]=LoadBMP("NEHE.bmp"); //
//Load the bitmap for the font.
TextureImage[10]=LoadBMP("font.bmp"); //Texture font
//Load the bitmap for the logo
TextureImage[11]=LoadBMP("logo.bmp"); //Humanities Project Logo
//Load the bitmaps for the introduction
TextureImage[12]=LoadBMP("earth.bmp"); //Earth bitmap
TextureImage[13]=LoadBMP("NEHE.bmp");
//Load the bitmaps for the credits
TextureImage[14]=LoadBMP("B1.bmp"); //Butterfly color 1
TextureImage[15]=LoadBMP("B2.bmp"); //Butterfly color 2
TextureImage[16]=LoadBMP("B3.bmp"); //Butterfly color 3
////////////////////////////////////////////////////////////////
//THESE TWO TEXTURES DON''T SHOW UP (BOTTEM 2)
////////////////////////////////////////////////////////////////
TextureImage[17]=LoadBMP("ols.bmp");
TextureImage[18]=LoadBMP("ols2.bmp");
Status=TRUE;
glGenTextures(18, &texture[0]); // Create The Texture
//Attach texture to specified "whatever", I use a ''for'' function to make coding less crowded.
for (queue=0; queue<18; queue++)
{
glBindTexture(GL_TEXTURE_2D, texture[queue]);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[queue]->sizeX, TextureImage[queue]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[queue]->data);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
}
queue=0;
for (queue=0; queue<18; queue++)
{
if (TextureImage[queue]) // If Texture Exists
{
if (TextureImage[queue]->data) // If Texture Image Exists
{
free(TextureImage[queue]->data); // Free The Texture Image Memory
}
free(TextureImage[queue]); // Free The Image Structure
}
}
return Status;
}
Textures not loading/showing...
Hello, I was in to developing my OpenGL program when I am suddenly matched with something wrong.
Here is my code for loading the textures:
Textures 17 and 18 show up, on a cube, as white. The texture intergration code works fine, but there seems to be something wrong with the above. I just can''t figure out what the problem is. All the textures above 17 load fine and do what I tell them to do, any numbers I put in after 16 don''t work.
Thanks in advance.
Load them seperately... do you realize how much memory you're allocating having all those in at once
. Anyways, make sure the bitmaps are loading properly by putting them in a different location that works. If they still don't work, then try re-saving the bitmap again in a different color depth, and make sure it works properly.
--- Edit ---
And, I just noticed that you're loading the same texture MANY times... any reason you're doing this? Why not just use the same texture ID for multiple objects, instead of loading the same bitmap so many times.
[edited by - Ready4Dis on April 4, 2003 4:42:42 PM]

--- Edit ---
And, I just noticed that you're loading the same texture MANY times... any reason you're doing this? Why not just use the same texture ID for multiple objects, instead of loading the same bitmap so many times.
[edited by - Ready4Dis on April 4, 2003 4:42:42 PM]
Why are you loading 9 same textures(Nehe.bmp)? I have a strange feeling everything will work if you cut down number of textures

Thanks for the fast replies.
The reason I have some of the same textures with the same name is because I''m currently in the middle of making my OpenGL project, and I just left them the same name until my partner provides me with the necessary pictures. I''m too lazy to go through the source code and change the IDs when I recieve the textures, the program is already 2,561 lines long and growing.
Oh yea, how do you load them seperatly? (I''m stupid but I''m learning!)
This is a history project by the way.
The reason I have some of the same textures with the same name is because I''m currently in the middle of making my OpenGL project, and I just left them the same name until my partner provides me with the necessary pictures. I''m too lazy to go through the source code and change the IDs when I recieve the textures, the program is already 2,561 lines long and growing.

Oh yea, how do you load them seperatly? (I''m stupid but I''m learning!)
This is a history project by the way.

np. Well, I guess you load one texture, draw it, unload it load other, etc. 
Besides, you are loading bitmaps. You know how much memory takes 18 of them?
2.5k lines???? Hmmm...nice
[edited by - pleja on April 4, 2003 5:44:29 PM]
[edited by - pleja on April 4, 2003 6:11:26 PM]

Besides, you are loading bitmaps. You know how much memory takes 18 of them?

2.5k lines???? Hmmm...nice

[edited by - pleja on April 4, 2003 5:44:29 PM]
[edited by - pleja on April 4, 2003 6:11:26 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement