Hi Todd,

I can't say for sure but it does sound like you are pushing through too many
state changes.  Ideally you should have a small number of independent
StateSet, and small number of unique Materials.  Rather than use Materials
for changing the material properites it's best to use vertex colours to set
the colour, doing so is far more efficient for the OSG and OpenGL.

Robert.

On Thu, Sep 10, 2009 at 10:53 PM, Todd J. Furlong <[email protected]>wrote:

> I have some code that creates OSG boxes and applies materials to the geodes
> containing those boxes.  It creates a flat scene graph (for now) with an
> osg::Group root node and an osg::MatrixTransform attached to the root node
> above each geode.
>
> I've noticed a huge frame rate reduction when I turn on the material
> assignment part of the code, which basically goes like this:
>
> osg::ref_ptr<osg::Material> material = new osg::Material;
> ...set material colors & static data variance...
> osg::StateSet *stateSet = geode->getOrCreateStateSet();
> ...set material attribute and static data variance...
>
> Here's where it gets weird (for me anyway):
> If I do the following...
> 1. set the rendering hint to DEFAULT_BIN
> 2. attach a node loaded with osgDB::readNodeFile (cow.osg will do) to the
> root node
> ...then the performance shoots up to where I want it to be.
>
> If I set the rendering hint to OPAQUE_BIN, I do not get the performance
> boost after loading a file.
>
> I think that either the OSG file or the loading code are setting some
> states that I need to get my performance back up, but I can't figure out
> which ones.  I've tried a lot of different settings to match up to cow.osg.
>  Display lists are turned on for the drawable, culling is turned on for the
> geode, and I've enabled all culling for the camera. I've set CULLFACE both
> on & off for the StateSet and set DataVariance to STATIC wherever I can.
>
> Any ideas?  I assume this is an easy fix, but I'm clearly missing
> something.
>
> Thanks,
> Todd
> _______________________________________________
> 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