Hi all,

I'm trying to swap textures on a node, based on event for exemple.
But let's see this simple code :


Code:
osg::Texture* tx1 = setTexture("test1.jpg");
osg::Texture* tx2 = setTexture("test2.jpg");

osg::Geode* sphereGeode = new osg::Geode;
osg::StateSet* state1 = sphereGeode1->getOrCreateStateSet();

state1->setTextureAttributeAndModes(0, tx1 );
state1->setTextureAttributeAndModes(0, tx2 );
state1->setTextureAttributeAndModes(0, tx1 );



This code crashes because modifying the content of tx1 when setting the tx2 
texture, so when re-applying tx1 in the third line, the tx1 pointer is 
corrupted!

So what is the way to manage multiple textures on the same node ? 
I don't want to use multiple textures indexes because I will probably swap on 
many and many textures...

Need I create a new StateSet per texture ?

Thanks

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





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

Reply via email to