PDA

View Full Version : 32 bit bmp



piazzesi
12-23-2003, 05:36 PM
Hi.
Im trying to load a 32 bit bmp, and im blocked, i had no problem loading 24 bit bmps, i changed GL_RGB to GL_RGBA and 3 to 4 parms. in glteximage2d, and i get an error i dont even know how i loaded 24 bit bmps anymore.

AUX_RGBImageRec *LoadBMP(char *Filename)
{
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

FILE *File=NULL;
if (!Filename)
{
return NULL;
}
File=fopen(Filename,"r");
if (File)
{
fclose(File);

return auxDIBImageLoad(Filename);
}
return NULL;
}

int LoadGLTextures()
{
int Status=FALSE;

AUX_RGBImageRec *TextureImage[100];
int v=2;
memset(TextureImage,0,sizeof(void *)*numtextures);

for (int lop=0; lop < numtextures; lop++){

if (TextureImage[lop]=LoadBMP(textures[lop].nametex))
{
Status=TRUE;
glGenTextures(1, &texture[lop]);

glBindTexture(GL_TEXTURE_2D, texture[lop]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_LINEAR);
if (lop==3){
glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureImage[lop]->sizeX, TextureImage[lop]->sizeY, 0, GL_RGBA, GL_UNSIGNED_BYTE, TextureImage[lop]->data);
}
else
{
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[lop]->sizeX, TextureImage[lop]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[lop]->data);
}
//return Status;
}


if (TextureImage[lop])
{
if (TextureImage[lop]->data)
{
free(TextureImage[lop]->data);
}
free(TextureImage[lop]);

}
}; return Status;
}


the fourth texture is the one in 32 bits.

Thanks

Mario Piazzesi

[This message has been edited by piazzesi (edited 12-23-2003).]

Tom Nuydens
12-23-2003, 10:58 PM
This is hardly an advanced question, so I'm moving the thread to the beginners forum.

Which error specifically do you get from glTexImage2D()?

-- Tom