Image displays blurry in aspect2d

Hi,

I’ve got the following source image:
.

I’ve created an egg for it with:

egg-texture-cards -wm clamp -g -1.3333,1.3333,-1,1 -p 1024,768 -o test.egg MenuMainRun.png

I show it with this code:

test= loader.loadModel('gui/menu/test.egg')
testImg= DirectLabel(geom= test.find('**/MenuMainRun'), relief= None)

When I run the code, Panda shows me this:

As you can see (check with any image viewer able to zoom), the display of the image is clearly more blurry than the original image.

How comes? What am I doing wrong?

Many thanks,
Max Hajek
Vienna, Austria

David - should these images be power of two in size?

Right. If your image is not a power of two, Panda will have to resize it at runtime, which will introduce some blurriness. It’s best to make your textures always be a power of two, but if you can’t or won’t for some reason, you can minimize the effect of this scaling by putting:

textures-power-2 up

in your Config.prc file, which will tell Panda to scale the textures up to the next larger power of two (instead of down), which should avoid any loss of detail (though you may have slight fuzziness from the fact that the pixels no longer match up one-to-one). Another option, if you have a very recent graphics card, is to put:

textures-power-2 none

which disables this scaling altogether, but requires that your graphics card supports non-power-of-two textures.

Other tricks are to disable mipmap filtering, or even any kind of filtering at all, on your texture with a pair of Python calls like this:

tex.setMinfilter(Texture.FTNearest)
tex.setMagfilter(Texture.FTNearest)

Note that even with all this, there may be some blurriness. Some graphics cards will just do that, and it’s beyond Panda’s control.

David

Thanks!

the textures-power-2 up option works perfectly.

Once more I am indebted to you guys. If you ever come to Vienna, drop me an email and I’ll give a show-around.

Cheers,
Max Hajek
Vienna, Austria