Hi all,

As noted in other threads, I'm currently working on an app that adds views at runtime. As expected, this causes the views created after the viewer has started running to have no textures on the models, because of the osg::Texture::_unrefImageDataAfterApply default setting of true.

Now, one solution would be to turn this off globally, for example by doing

    osgUtil::Optimizer::TextureVisitor tv(
        true, false, false, false, false, 1.0, 0);
    loadedModel->accept(tv);

for every loaded model file. However, that will waste memory most of the time, since new views will only be added occasionally.

A more efficient solution might be to reload the textures when a new view is ready to be rendered for the first time. However, as I understand it, an osg::Texture does not retain any information as to where its image data came from, so I don't see how I would do this.

Has anyone thought of this, or tried to implement it? Is there already a mechanism for that in OSG which I'm just not aware of?

Also, I've noticed the osg::Texture::_clientStorageHint, what does that do?

Finally, on the subject of the osgUtil::Optimizer::TextureVisitor, it could have an option to change the _resizeNonPowerOfTwoHint, now that most recent video cards implement quite fast support for NPOT textures and some users might want to make use of it on existing models without modifying the models directly. I'll try to submit this soon.

Thanks in advance,

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