Yes you are right :) I was just about to post that i followed that hint and 
used it. It works now. Thanks.


Ulrich Hertlein wrote:
> Hi Otto,
> 
> On 27/10/09 10:12 AM, Otto Cologne wrote:
> 
> > I'm having a crash with setTextureAttributeAndModes I don't know how to fix.
> > 
> > To explain the issue. I have a list of data sets which hold a pointer to a
> > osg::Texture3D. The texture mixing is done in a shader and my texture 
> > update function
> > containing the following loop is called from an update  callback. Since the 
> > order of
> > the textures can/must change i loop over the textures and do this
> > ...
> > 
> > osg::StateSet* sliceState = m_sliceNode->getOrCreateStateSet(); for ( 
> > size_t i = 0; i<
> > datasetList.size(); ++i) { osg::Texture3D* texture3D = datasetList[i]
> > )->getTexture3D(); sliceState->setTextureAttributeAndModes( i, texture3D,
> > osg::StateAttribute::ON ); }
> > 
> > This works just find when adding one texture after another. However when 
> > the order
> > changes, thus overwriting a different order it crashes. So apparently I'm 
> > doing it
> > wrong.
> > 
> 
> David already hinted at the answer: you need to use ref_ptr<Texture3D> for 
> your 
> datasetList, not Texture3D*.
> 
> Or manually do a 'ref' on each object.
> 
> Cheers,
> /ulrich
> _______________________________________________
> osg-users mailing list
> 
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 
>  ------------------
> Post generated by Mail2Forum


------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=18770#18770





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to