Let's say I want to change the color of my road segment (when selected for 
instance). We're currently doing this modification that way:

        osg::Vec4Array* lCouleur = 
(osg::Vec4Array*)(mGeometrie->getColorArray());
        *(lCouleur->begin()) = pCouleur;
        mGeometrie->dirtyDisplayList(); 

>From what you're saying, I guess we should create a different stateset for 
>every color instead of a stateset for every segment? Maybe I should ask first 
>if the color is indeed part of the stateset anyway! If not, we could reduce 
>the stateset count even more!

Thanks!

Frederic Drolet, M. Sc.
Computing Solutions and Experimentations | Solutions informatiques et 
expérimentations
Systems of Systems | Systèmes de systèmes
DRDC Valcartier | RDDC Valcartier
2459, boul. Pie-XI North
Quebec, Quebec
G3J 1X5 CANADA
Phone | Téléphone: (418) 844-4000 ext : 4820
Fax | Télécopieur: (418) 844-4538
E-mail | Courriel: [email protected]
Web : www.valcartier.drdc-rddc.gc.ca
-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Thrall, Bryan
Sent: Friday, March 12, 2010 10:39 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Multi-view Performance Issue with Statesets

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
[email protected]
  


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

Reply via email to