Hi Robert,

> Or... just use the Stats feature that
> does just this.  Have a look at the src/osgViewer/StatsHandler.cpp to
> see how the Stats collection can be enabled and used.
>

Thanks for the quick reply, this worked great. I'm just posting a small
snippet in case anyone else searches the list for something similar since
it took me a little while to narrow down what I was looking for.

// enable stat collection for scene
myViewer->getStats()->collectStats("scene",true);

// enable stat collection for camera (do this after rendering/everything is
setup)
myViewer->getCamera()->getStats()->collectStats("scene",true);

    // dump some stats in between frame calls
    osg::Stats * sceneStats = m_osg_viewer->getCamera()->getStats();
    osg::Stats::AttributeMap attMap =
            sceneStats->getAttributeMap(sceneStats->getLatestFrameNumber());

    size_t numObjects = 0;
    size_t numTris = 0;
    size_t numVx = 0;
    osg::Stats::AttributeMap::iterator amIt;
    for(amIt  = attMap.begin();
        amIt != attMap.end(); ++amIt)
    {
        std::cout << amIt->first << "," << amIt->second << std::endl;
    }
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to