Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


scalling bitmaps via software

This topic is 5492 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

I have just done a software strech routine for my texture manager which will strech a raw BMP (24/32 bit) to any size.. at the moment it is just using a linear way to expand (or shrink) it.. is there any documentation I can be pointed which explains how averaging works or some better way to strech the data without coping the same data all the time.. (if that makes sence).. here is how I am currently doing it..
// scale the raw image data to the new size..
GLubyte *TextureLoader::ScaleTGA(GLubyte *pImgData, GLuint oldWidth, GLuint oldHeight, GLuint Bpp, GLuint newWidth, GLuint newHeight)
	GLuint	x, y;
	GLubyte	*pNewImgData;

	// allocated the some memory for the new texture
	pNewImgData = (GLubyte *)malloc(newWidth * newHeight * Bpp);					
	// work out the stepping values to use in the scalling..
	float stepX = (float)oldWidth / (float)newWidth;
	float stepY = (float)oldHeight / (float)newHeight;

	float	fX, fY;

	fY = 0;

	// if 24 bit (RGB)
	if (Bpp == 3)
		for (y=0; y
Jumpman - Under Construction

Share this post

Link to post
Share on other sites

  • 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!