Automatic Texture Scaling

Hi Everyone,

I’m having difficulties shutting off automatic scaling of textures to a power of two. I tried setting a config variable without any luck:

loadPrcFileData('', 'textures_power_2 ATS_none')

Also tried the prc file too with:

textures_power_2 ATS_none

I’m wondering if the hardware requires power of two textures, does panda ignore these flags?

Also if it isn’t possible to always shut scaling off, is there a way to specify the resampling mode as nearest neighbor? That would work for me too.

Thanks.

-Greg

ATS_* are variables name. If you want to assign it to config var, you must want to use its value instead, which is none.

Right, and note that the config variable is spelled with hyphens, not underscores, so you should be setting “textures-power-2 none”, not “textures_power_2 ATS_none”.

If you want to set the texture to nearest-neighbor filtering, use:

tex = loader.loadTexture('foo.png')
tex.setMinfilter(tex.FTLinear)
tex.setMagfilter(tex.FTLinear)

If your goal is to achieve pixel-accurate rendering, you might do well with the egg-texture-cards command, which can create a card exactly the right size to display a texture the way you painted it.

David

Thanks, those prc tips will definitely keep me from chasing my tail in the future.

I was able to shut it off at the texture object with this:

texture.setTexturesPower2(0)

Instead of passing an integer, I wanted to find a named enumeration, but for the life of me couldn’t figure it out. I ended up grepping for the AutoTextureScale enumeration value in the source code. Is this how you’re supposed to do it?

Thanks again for responding.

-Greg

Hmm, for whatever reason, we forgot to publish the AutoTextureScale enum, which is why you couldn’t find it in Python. I’ll fix that.

David