Page 1 of 1

Autoscaling a grafic from non n² to n²

Posted: Mon Jan 05, 2009 11:00 am
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

Posted: Mon Jan 05, 2009 4:42 pm
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.

Posted: Thu Jan 08, 2009 12:21 pm
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