Sign in to follow this  

BMP Texture loading function

This topic is 3453 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


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
}


is there anything in the above code that could slow down my program?

Share this post


Link to post
Share on other sites
Is the function ever called? If so, then it will take some amount of time to execute.

If the amount of time it takes is long enough to 'slow down' your program, then yes, it will slow down your program.

Share this post


Link to post
Share on other sites
Yes, any additional code will slow down an application. The question is just by how much and what are the alternatives.

1. There is nothing wrong with the code there, seems valid to load a bitmap using the glaux library.

2. By slow I presume you must be timing this somehow? Remember a drop from 400 FPS to 200 FPS is not a big difference. However 40FPS to 30FPS is!

3. There are other newer/better libraries out there such as FreeImage/DevIL which are not deprecated like the glaux library you are using.

Share this post


Link to post
Share on other sites

This topic is 3453 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this