HI Fabrizo,

Normally just doing image->dirty() would be sufficient to get the texture
object to be updated, for this not work something else is likely to be
amiss.

Is there any chance you are running osgUtil::Optimizer on the scene graph
after it's set up, such that the texture->setUnRefImageAfterApply() has
been set?  This settings is ideal for static scene graphs, but is
inappropriate for dynamic imagery.  I have just checked the
Optimizer::TextureVisitor::apply(osg::Texture& texture) implementation in
src/osgUtil/Optimizer.cpp and it doesn't apply the UnRef setting for
ImageStreams, but for standard Images it does by default.  An improvement
to this code would be to add a check to see if the osg::Image::DataVariance
is set to STATIC when applying the UnRef setting.  For your code you'd
still need to call image->setDataVariance(DYNAMIC) even with this suggested
change applied to the osgUtil::Optimizer code.

Robert.


On 29 August 2014 14:38, Fabrizio Bazzurri <[email protected]> wrote:

> Hi Sebastian,
>
> yes, if I uncomment the second to last row of the code:
> Code:
> diffuseTex->setImage(diffuseImage);
>
>  the texture correctly updates, but I thought that using dirty() on image
> was the correct way to do this (I'm asking this because my application has
> many textures referred to the same image and I would like to change the
> image one time and update all textures automatically without using a
> NodeVisitor).
>
> Cheers,
> Fabrizio
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=60846#60846
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to