Skip to main content
gamedev.net
🔒 Locked

bitmaps!!! grrrr

Started by s0lus 4 replies 1k views
Original Post
s0lus
s0lus
ok so im doin the nehe tutorials...and i got to the importing of a bitmap to be placed upon the sides of a rotating cubes...it is not working for me....i just get a white cube... here is my code please help me... : AUX_RGBImageRec *LoadBMP(char *Filename) // Loads A Bitmap Image { FILE *File=NULL; // File Handle if (!Filename) // Make Sure A Filename Was Given { return NULL; // If Not Return NULL } File=fopen(Filename,"r"); // Check To See If The File Exists if (File) // Does The File Exist? { fclose(File); // Close The Handle return auxDIBImageLoad(Filename); // Load The Bitmap And Return A Pointer } return NULL; // If Load Failed Return NULL } int LoadGLTextures() // Load Bitmaps And Convert To Textures { int Status=FALSE; // Status Indicator AUX_RGBImageRec *TextureImage[1]; // Create Storage Space For The Texture memset(TextureImage,0,sizeof(void *)*1); // Set The Pointer To NULL // Load The Bitmap, Check For Errors, If Bitmap''s Not Found Quit if (TextureImage[0]=LoadBMP("scan00013.bmp")) { Status=TRUE; // Set The Status To TRUE glGenTextures(1, &texture[0]); // Create The Texture // Typical Texture Generation Using Data From The Bitmap glBindTexture(GL_TEXTURE_2D, texture[0]); // Generate The Texture glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); // Linear Filtering glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); // Linear Filtering } if (TextureImage[0]) // If Texture Exists { if (TextureImage[0]->data) // If Texture Image Exists { free(TextureImage[0]->data); // Free The Texture Image Memory } free(TextureImage[0]); // Free The Image Structure } return Status; // Return The Status }
Julio
Julio
you''re calling glEnable(GL_TEXTURE_2D); right?

My Homepage
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911
s0lus
s0lus
i also made sure the bitmap was a 2^x whatever and that it fit the color rules...still dont know why its not working....
s0lus
s0lus
yeah i am....
s0lus
s0lus
does it have to do with this section of code? am i doing this right?

if (TextureImage[0]=LoadBMP("scan00013.bmp"))
{
Status=TRUE; // Set The Status To TRUE
glGenTextures(1, &texture[0]);

i added the bmp to the project i dunno why its not working properly...
s0lus
s0lus
nm...im stupid, i fixed it...hehe

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.