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 [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

