Hi,

I had some serious problems getting a hardware-skinned model texured because 
the skinning-shader overwrites the statesete of the model. With that all loaded 
textures and other material-stuff were deleted.

So here's a tiny diff, that makes use of the existing stateset:

Code:
Index: src/osgAnimation/RigTransformHardware.cpp
===================================================================
--- src/osgAnimation/RigTransformHardware.cpp   (revision 11685)
+++ src/osgAnimation/RigTransformHardware.cpp   (working copy)
@@ -255,11 +255,11 @@
     }
     program->addShader(_shader.get());
 
-    osg::ref_ptr<osg::StateSet> ss = new osg::StateSet;
+    osg::StateSet* ss = geom.getOrCreateStateSet();
     ss->addUniform(getMatrixPaletteUniform());
     ss->addUniform(new osg::Uniform("nbBonesPerVertex", 
getNumBonesPerVertex()));
     ss->setAttributeAndModes(program.get());
-    geom.setStateSet(ss.get());
+
     _needInit = false;
     return true;
 }



 



Cheers,
Rob

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





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

Reply via email to