Drolet, Frederic wrote on 2010-03-12: 
> osg::ref_ptr<osg::StateSet> lStateSet = mGeometrie-
>> getOrCreateStateSet();
> 
> lStateSet->setMode(GL_LIGHTING, osg::StateAttribute::OFF);

OpenGL performance is very sensitive to state changes, so it is a good idea to 
minimize them as much as possible. OSG groups Drawables with the same state as 
part of this (the exception is transparent drawables that require a certain 
ordering to render correctly, so they can't be grouped), but it just compares 
the StateSet pointers rather than a (much more expensive) comparison of what 
OpenGL state the StateSet pointers represent.

Therefore, if you have a bunch of StateSets that are identical, like you seem 
to have, it is a really good idea to just use the same StateSet object 
everywhere you need it, rather than create a new instance every time.

HTH,
--
Bryan Thrall
FlightSafety International
bryan.thr...@flightsafety.com
  


_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to