Hi Vincent, Camera's don't have a Stats object assigned to them by default, you have to assign it. osgViewer does assign Stats for the viewer camera, or at least in 2.8. Go check the differences between the viewer libs.
Robert. On Thu, Apr 23, 2009 at 9:34 AM, Vincent Bourdier <[email protected]> wrote: > Hi Robert, > > I am using the 2.6.1 that's why I didn't found stats code. > For the moment, I just copy the code from 2.8 concerning camera stats > (visible vertices, ...) but it does not work correctly : > > In the StatsHandler, in the case of camera stats, there is : >> >> for(osgViewer::ViewerBase::Cameras::iterator itr = cameras.begin(); >> itr != cameras.end(); >> ++itr) >> { >> osg::Stats* stats = _camera->getStats(); >> if (stats) >> { >> stats->collectStats("scene",true); >> } >> } > > But when I do _camera->getStats(), I get NULL ... so the stats do not > contain anything so I have no stats on the screen. > I didn't found if there is an other initialization or something to do on > camera to get/compute the stats ... my Handler is very close to the > StatsHandler of the 2.8... > > What do I miss ? > > Thanks a lot. > > Regards, > Vincent > > 2009/4/22 Robert Osfield <[email protected]> >> >> Hi Vincent, >> >> The osgviewer stats has scene info collection and works pretty fast so >> I'm surprised similar code of yours has problems. Is you scene >> particular big? How many nodes/geometries etc? >> >> As for running in a separate thread when not run the thread in a >> parallel to the viewer.renderingTraversals(); just put a barrier >> before and after the call to renderingTraversals(). >> >> Robert. >> >> On Wed, Apr 22, 2009 at 3:53 PM, Vincent Bourdier >> <[email protected]> wrote: >> > Hi, >> > >> > I have a problem of how-to : >> > >> > I have a function, which need to run into the graph to count the >> > visible >> > and total number of face. This is a code which is not so quick... so I >> > would >> > like to put it in a separate thread to avoid my application lags. >> > But, my thread isn't synchronized yet, so in case of the graph >> > modification >> > ... it crashes. >> > >> > How can I set my thread to be synchronized with osg threads, keeping the >> > thread advantage or parallel process to avoid the user seeing a lag when >> > the >> > algorithm traverse the graph ? >> > >> > This algorithm is based on NodeVisistors, does it change anything ? >> > >> > Thanks for help. >> > >> > Regards, >> > Vincent. >> > >> > _______________________________________________ >> > 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 > > > _______________________________________________ > 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

