[osg-users] Extending the osgViewer::StatsHandler graph

Robert Osfield robert.osfield at gmail.com
Thu Mar 12 01:55:20 PDT 2009

Hi Alex,

There are three parts to stats - the stats storage, gathering and the
stats display.

The osg::Stats class is a thread safe container for storing collected
stats data, and various OSG classes can have Stats objects attached to
them, such as osg::Camera and osg::View.

The various traversals then fill the above Stats obects with data, in
particular it's the Viewer/CompositeViewer/Renderer that do most of
the stats collection.

Then we have the StatsHandler that switches on the stats collect so
the above start collecting and storing stats, and then displays the

To add custom stats you'll just need to add your own stats collection,
and you may be able to simply reuse one of the exiting osg::Stats
object as a place to dump this data, then subclass from
osgViewer::StatsHandler or simply derive your own for the display of
your stats.


On Wed, Mar 11, 2009 at 7:01 PM, Alex French <osgforum at tevs.eu> wrote:
> What would it take to add another attribute to the statshandler graph? In my scene graph I do physics calculations between frames, and it would be nice if I could say, start a timer before I run my physics loop, end the timer when it's finished, and have that time added to the statistics overlay.
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=8285#8285
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

More information about the osg-users mailing list