Hi All,

I have just checked some preliminary work on display of graphical bars
to illustrate the relative timing of frames.  I have not yet added
frame boundary markers so it still looks a bit naked compared to the
old stats, this is just eye candy that I can add at some point this
week.  I also haven't yet added the primitive stats, this will require
a little extra functionality in osg::Stats to allow expensive stats
options to be turned on/off as required.

The key achievementt is that I now have stats viewer and camera
collects via the new osg::Stats class, and display in osgviewer via a
custom event handler.  The later uses entirely standard OSG components
- osgText - for the text, osg::Geometry for the bars with draw
callbacks for updating their values, and an osg::Camera to set up the
projection and view matrices for the HUD.  The on screens stats are
therefore a mini scene graph entirely dedicated to stats.

The use of the osg::Camera to set up the HUD is also of interest in
its own right as its the first test of a new way of doing HUDs in the
OSG.  Basically the GraphicsWindow is assigned to this stats Camera
and the viewer is then told is setUpRenderingSupport() and it
automatically wires up the window to render this camera in addition to
the other cameras already assigned to the viewer.  The key difference
to previous HUD's is that you don't add the HUD camera to the main
scene graph, you add the window to the HUD camera directly. I'll write
more about different ways to do HUD later (I'll modify osghud with
different ways).

Another area of interest with the new stats is that I have tried to
estimate the begin and end times of the draw traversal down on the
GPU.  The GL_EXT_timer_query used to collect the GPU times just gives
elapsed time, not start or end, so have to estimate when the draw
completed.  The best I could come up with was to poll whether the
query had succeed and record the time that this query was made up.
If a query doesn't succeed then the next querry it does succeed you
know that the end time was between the time of the two queries.  The
question is where between them - it could just after the previous
querry, or right before the successful one.  For the code in CVS I
have popped for the average time in between the two.  The more often
one polls for the query the tighter bound you have on when the
completion occurred.

With this work I have found that my machine is really sensitive to the
powersave program that I have running by default - this program idles
the processor what full performance is required - it plays havock with
the stability of the GPU stats.  Even when I lock the CPU rate to full
speed the program still keeps interupting things, but when I kill it
my frame rates and cull/draw times all become much more stable and
predictable.   I presume that will be the case for many computers
these days so its something to watch out for.

Have fun,
Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to