have been having problems creating textures from bitmaps in opengl
it works fine using bitmaps i've downloaded (the ones included with nehe tutorials) however when i try creating my own in paint the program doesnt display them (just shows a white box)
texture loading functions (straight from nehe)
AUX_RGBImageRec *LoadBMP(char *Filename)
{
FILE *File = NULL; //filehandle
if(!Filename) { //make sure a filename was given
return(NULL);
}
File = fopen(Filename, "r"); //check to see if file exists
if(File) {
fclose(File);
return(auxDIBImageLoad(Filename)); //loads the bitmap and returns a pointer
}
return(NULL);
}
int LoadGLTextures(void)
{
int Status = FALSE;
AUX_RGBImageRec *TextureImage[1]; //create storage space for texture
memset(TextureImage, 0, sizeof(void *)*1); //set the pointer to NULL (make sure its empty)
//load bitmap, if bitmaps not found quit
if(TextureImage[0]=LoadBMP("data/tri.bmp")) {
Status = TRUE;
glGenTextures(1, &texture[0]); //create the texture
//typical texture generation using data from the bitmap
glBindTexture(GL_TEXTURE_2D, texture[0]);
//texture filters
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
//generate the texture
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
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);
}
relevant SDL init code
//set up SDL/GL window properties
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
only thing i can think of is its something to do with that bitmaps rgba values, both bitmaps (nehe and mine) are 24bit and have tried changing the SDL bitmap settings above to r=8, g=8, b=8 but still get the same
anyone know what paint saves bitmaps as or what i'm missing (or anyway to get opengl to load any type of bitmap)?
thanks