I'm trying to load a Quad with a Monster Image on it that will always face the Camera, a la Doom 2.
Now I don't know how to load an image with an Alpha part on it.
In 2D using SDL I always used tga files.
Here is my LoadTexture functions.
Does anyone have an idea?
Thanks a lot.
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[12]; // Create Storage Space For The Texture
memset(TextureImage,0,sizeof(void *)*1); // Set The Pointer To NULL
//TEXTURE 0
// Load The Bitmap, Check For Errors, If Bitmap's Not Found Quit
if (TextureImage[0]=LoadBMP("Data/Grass00.bmp"))
{
Status=TRUE; // Set The Status To TRUE
}
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
}
memset(TextureImage,0,sizeof(void *)*1); // Set The Pointer To NULL
Think that 1 is suppose to be 12, but you can default initialize the array with zero. So you don't have to worry about the number in 2 places, and create an error like you just did.