Autoscaling a grafic from non n² to n²

Just starting out? Need help? Post your questions and find answers here.
energy
User
User
Posts: 19
Joined: Sat Aug 04, 2007 1:05 pm
Location: Germany

Autoscaling a grafic from non n² to n²

Post by energy »

Hello!
does anyone know an api or gdi+ function to
autoscale images from non power of two to power of two
to automaticly resizing images for opengl if the image is non power of two?
cheers and thanx...
:D
superadnim
Enthusiast
Enthusiast
Posts: 480
Joined: Thu Jul 27, 2006 4:06 am

Post by superadnim »

for one, currently most gpus support the rectangular extension for textures, so you don't have to pre-process any data, you just send it to opengl and opengl handles the rest. so only fall back to the method of resizing to a POT if that option is not available.

you can use the pb functions to resize the image, all you need to do is find the nearest power of 2, scale to that size and use the new image with opengl. it's not going to be fast if you'll be using point/plot method but there are other alternatives outlined throughout the forums, just search.

for using extensions, I recommend you go to the appropriate opengl forum where people will suggest you GLEW, etc.

keep in mind that (perhaps) the alpha channel (if any) will be lost while resizing, if pb doesn't handle them correctly.

:lol: should I bash the keyboard and give up?
:?
energy
User
User
Posts: 19
Joined: Sat Aug 04, 2007 1:05 pm
Location: Germany

Post by energy »

Thanx for yur answer...
i thought that there is a automaticscale to POT,
but now im following to search the nearest POT
and rescale the picture...
cheers and thanx
Post Reply