[osg-users] State changes causing huge drop in framerate

J.P. Delport jpdelport at csir.co.za
Wed Apr 6 06:24:20 PDT 2011

Hi Fred,

maybe have a look at this:

I remember something like that state equality is only tested using 
pointers and not internal data. So, maybe you'll have to explicitly 
share state (that getOrCreate won't do).

Sorry I can't actually answer from more experience.


On 06/04/11 15:14, Fred Smith wrote:
> Hi,
> I have a very large scene graph where I have many geodes.
> Each of this geode has a stateset with a GPU program defined on it,
> contianing a vertex and a fragment shader.
> The GPU program instance is unique for my whole application - I am
> not recreating the program over and over again for every geode. This
> would be an easy, silly mistake.
> I have done performance tests and having a StateSet assigned to each
> Geode causes a MASSIVE performance drop. For a given model,
> containing thousands of geodes, the framerate goes from 64 to 30 fps
> just when you call getOrCreateStateSet on every geode, causing state
> to be created on each individual geode.
> An OpenGL trace shows that OSG is clever enough to avoid calling
> glUseProgram(id) / glUseProgram(0) in between every geode being
> rendered. Declaring the GPU program once, on the topmost graph node,
> and not on every geode, results in the same GL trace, with no
> performance degradation. This suggests OSG is very heavily using the
> CPU to 'diff' the state changes across geodes.
> Is there a way, maybe by fiddling with OVERRIDE/PROTECTED flags, to
> improve the way OSG handles state changes, in order to keep good
> performance?
> Cheers, Fred
> ------------------ Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=38256#38256
> _______________________________________________ osg-users mailing
> list osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.

More information about the osg-users mailing list