Robert,
Thanks for the tips. I definitely need to take another pass at this &
optimize it better.
As to my original issue, it turned out to be a threading issue in a .NET
UserControl. The app was somehow able to escape the problem
consistently by loading a model. I had gotten creative and attempted to
call osgViewer::frame in an override of the OnPaint method so that I
could keep all osgViewer calls on the UI thread. I had a Forms timer
that was hammering the control with Invalidate events more often than it
should have. Now it appears to be stable.
Thanks again,
Todd
On 9/11/2009 4:00 AM, Robert Osfield wrote:
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 <t...@inv3rsion.com
<mailto:t...@inv3rsion.com>> 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
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org