image in C++

ok i tried loading some image and they give me some problem
overall nothing is wrong, they are rendered out, no error.

but the size is wrong and the quality of the image went down.
i debug and realise that panda will auto resize the image to a certain size.
e.g. 10241024, 512512, 256*256

and they will scale down the image, e.g. a 800600 they resize to 512512.

resize them back may not be a big problem, but you can see some difference in the quality of the rendered image compared to the actual one.

anyone know how to fix this?

thats no c++ specific issue. its panda’s default setting… read here ->http://panda3d.org/manual/index.php/Choosing_a_Texture_Size
reson for this is simple. most cards dont support no non-power-of-2 textures. only some new ones do.

yes in open GL mode it can hose havock by rendering non power of 2 in software dropping your frame rates for no reason.

ok. i tried changing the config.prc
it works for me, but is there a way to change it using my codes?
and is there anyway that i can find out which graphics card is able to do this?

from pandac.PandaModules import loadPrcFileData
loadPrcFileData("","textures-power-2 none")

You can find out whether your graphics card support textures of non-power of two sizes using this:

base.win.getGsg().getSupportsTexNonPow2()

ok thx!
now i will find the functions in c++

Oh, sorry! Forgot you were using c++.
In c++, it would be something like:

#include "load_prc_file.h"
load_prc_file_data("","textures-power-2 none");

and:

window->get_gsg()->get_supports_tex_non_pow2();

thx!

its a really great help

but the second code should be

window->get_graphics_window()->get_gsg()->get_supports_tex_non_pow2()

Oh, right, sorry. Been programming too long in python :wink: