Jump to content
  • Advertisement
Sign in to follow this  
sp33dy

Best/Quick scaling of a non power two image

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

Anyone able to advise the quickest/best way to scale a loaded image to the nearest power of two. I've got a GFX card that doesn't support Non-Power 2 images. I would like to include a function that stretches a non-power of two image to the next power of 2. I.E. if I load an 800x600 image (4:3), I'd like it to create a 1024 x 1024 image, with the image width stretched to 1024 and with a height of 768 (with black padding top/bottom). Further more, I'd like to have an option to perform a full stretch to 1024 for height as well. Any opinions would be appreciated (although sample code would be better!).. I've google around and can't seem to find a good example. Somebody out there must have done this. Thanks and regards Sp33dy

Share this post


Link to post
Share on other sites
Advertisement
I do this in SOIL (check my sig) which is public domain source. (I'm not saying my way is the quickest/best, but it works for me [8^). I only do full scaling, I don't pad with black.

Share this post


Link to post
Share on other sites
Thanks,

>Lonesock, I'm just looking through your code.

> Linuxhippy3, Just looked into FBO's. I see they are used for offscreen drawing and then rendered back to Quad. So I guess you can load a non-power of 2 in. However, how do I scale it? Is there a standard Opengl (or SDL) function that can be used to blit/scale? I'm hunting through the docs at moment. I was hoping for a quick answer..

Thanks to both of you for your time.

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!