Jump to content
  • Advertisement
Sign in to follow this  
Andrew1979

BMP Texture loading function

This topic is 3731 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!