Hello Alfonso,

I don't know how to do it. I want to disable this option because when these road textures are first "seen" by the camera, the program stops for a moment to scale them to the power of two and it is quite rough.

You have a few options, and not all of them are disabling that hint...

1. Of course, you can ask your modelers to use powers of two in texture sizes.

2. You can use osgconv to do the resize offline (osgconv in.osg out.osg). The resulting model will be the same thing that you get when it's done at run time, but the program won't need to scale the textures, they'll already be scaled. You can even take this opportunity to make other things more efficient, like if you choose .ive as your output format the loading will likely take less time, and if you use the --compressed argument you'll get compressed textures that take less texture memory on the video card.

These two options are good because they don't force you to use video cards that support NPOT textures. These are quite common now, but if you have a wide user/customer base (or you want to) then you want to support as wide an array of hardware as possible, and using POT textures is one factor in that.

3. If you really want to disable the resizeNPOTHint, you need to write a visitor that you'll run just after loading a model. This visitor will traverse the loaded graph and for each node and drawable, check if the stateset contains a texture, and if so disable the hint. No such visitor exists right now, but you can take inspiration from the osgUtil::Optimizer::TextureVisitor which does this for other texture settings.

I was planning on extending osgUtil::Optimizer::TextureVisitor to support this option sometime, but it's a "wish list" item so it could take some time for me to get to it. If you want to do something like that, I encourage you to do it there and submit the modified files so that all could have this added capability in a future version of OSG.

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    [email protected]
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to