Hi JS, I've merged your changes and tested your modified osgviewer example, and found that while the stats worked, the normal dark gray background to the stats was not updated correctly, this is pretty obvious when you run your modified osgviewer so I'll assume you'll be able to see the problem first hand and fix it.
To help move things along I have merged your changes as it only seems to be the user stats that causes problems with the alignment of the dark grey background. I think it'd be useful to have an example of user stats in action, would it be possible to simply your modified osgviewer so it just focuses on the user stats, and then just rename it to something like osguserstats. We can then use this as an example and a testbed. Cheers, Robert. On Tue, Oct 19, 2010 at 10:45 PM, Jean-Sébastien Guay <[email protected]> wrote: > Hi Robert, > > This submission includes my previous StatsHandler submission, so you might > want to review that one first so you can do smaller blocks at a time. > > Also, I know this may not be the best time to merge this kind of change, so > I'll understand if it gets shelved for a while. > > With that out of the way... > > For a long time now I've wanted to be able to add custom values into the > stats handler's graph. Here is my proposal of how I'd do this. It's surely > not perfect and I'm open to suggestions, but I've already made more changes > than I wanted to in order to be able to implement this... > > The user calls statsHandler->addUserStatsLine() providing: > > - the label they want for that line in the graph > - the text and bar colors they want in the graph > - the stats names they want queried (one for time taken, one for begin and > one for end time) and a few settings for how these will be displayed. > > Then all they have to do is call > viewer->getViewerStats()->setAttribute(framenumber, name, value) for their > three attributes each frame and they'll have their stats in the graph. > > They can also give only a time taken attribute (or some other numerical > value they want printed, which can be averaged or not), or only begin+end > attributes, and the graph will accordingly display only the (average or not) > numerical value or only the bars. > > Along the way I cleaned up the existing code a bit: > > * Each time the setUpScene() or createCameraTimeStats() methods added a line > to the graph, they did pretty much the same thing, so I moved that into a > separate method called createTimeStatsLine() which is called by setUpScene() > and createCameraTimeStats(). > > * I moved the font, characterSize, startBlocks and leftPos variables to > member variables, since they were being passed around everywhere but were > set only once at the beginning. > > * The geode on which stats lines are added is also kept in a member > variable, and createCameraTimeStats() adds the per-camera lines to this > geode instead of returning a new Group with a new Geode. This further > reduces the number of variables the createCameraTimeStats() method needs as > input. > > I've also included a modified osgViewer that demonstrates this. This is just > to show the new functionality, it's not anything useful... :-) > > There are a few things that would be nice to add, one of which is a way for > the custom values to be forced to the top or the bottom of the stats lines > (currently they will show up at the top of all other stats lines, in the > order they were added, then there will be the normal event, update, cull, > draw, gpu). Also, I think the addUserStatsLine() method takes too many > arguments, so it's a bit hard to use. It could use a bit more documentation > :-S > > This will be very useful I think for client apps whose processing might be > done in threads that could be parallel or sequential to the different OSG > rendering phases. They will be able to easily add their stats and have a > visual representation alongside the rendering stats. > > Thanks, > > J-S > -- > ______________________________________________________ > Jean-Sebastien Guay [email protected] > http://www.cm-labs.com/ > http://whitestar02.webhop.org/ > > _______________________________________________ > osg-submissions mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org > > _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
