Page 1 of 1

addImage in GUI distorts my Image file??

Posted: Sat Jun 16, 2007 2:37 pm
by beshrkayali
hey all

I'm using addImage to make my game's menu screen, but in the game, my images looks distorted? how can i make it work? with the original image quality?
:cry:

Posted: Sat Jun 16, 2007 3:18 pm
by Acki
I think the dimension of the image is wrong...
It must be in power of 2 (2^0, 2^1, 2^2, 2^3, 2^4, ...) !!!
So be sure the dimensions are correct (for example 512 x 512) ... ;)

Posted: Sat Jun 16, 2007 4:36 pm
by beshrkayali
thank you :P :P :P
it worked
i didn't know that :D

Posted: Sat Jun 16, 2007 8:30 pm
by Acki
yeah, it's a common error and asked many times here... ;)
A search on the forum probably helped you quicker... :lol:

Posted: Sat Jun 16, 2007 8:36 pm
by eneru
addImage uses the original dimension of the texture though, right ?
So even if the image is not a power of 2 it should work... a priori.. ?

Posted: Sun Jun 17, 2007 2:00 am
by Dances
eneru wrote:addImage uses the original dimension of the texture though, right ?
So even if the image is not a power of 2 it should work... a priori.. ?
That image still has to be sent to your video card, which will get angry at non-power of two images and distort them. There are some video cards out there that handle non-power of 2, but most don't. Basically what this means is this really isn't Irrlicht's fault at all. The closest thing to a fix would be for Irrlicht to determine the closest power of 2 resolution and resample everything.

Posted: Sun Jun 17, 2007 5:03 am
by Acki
Dances wrote:The closest thing to a fix would be for Irrlicht to determine the closest power of 2 resolution and resample everything.
AFAIK this is exactly what happens by the graphics card...
the image will be scaled to the next power of 2...
this is the reason why the image looks bad afterwards... ;)

If you use an ITexture you can check if it's scaled with getSize() and getOriginalSize() !!! 8)

Posted: Mon Jun 18, 2007 2:26 pm
by andoba
So, if for example I want to do a image for filling the whole screen (1680x1060, in my case) I'd have to make tiny images that are power of two?

And, why in SDL I can load up that same image and it looks perfect? :?

Sure they're different things, but there is some way for loading images that they're size isn't a power of 2?

Thanks.

Posted: Mon Jun 18, 2007 2:40 pm
by bitplane
you could load it in to system ram as an image, split into (for example) 256x256 tiles, turn them in to textures and only draw the visible sections

Posted: Mon Jun 18, 2007 9:28 pm
by Dances
You could also make the image higher than the required resolution. Formats like PNG are really forgiving on large amounts of black or white space.