Sign in to follow this  
sp33dy

Best/Quick scaling of a non power two image

Recommended Posts

sp33dy    133
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
lonesock    807
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
sp33dy    133
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

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