Hi All,
I've just checked in improvements to the way that osgViewer manages
the per frame compilation and flushing of deleted OpenGL objects.
These controls are of particular importance to running the OSG with
paged databases. These new controls should make avoiding frame drops
easier or to speed up merging of new tiles.
osgProducer used have this feature, albeit in a cruder form, and
DatabasePager had methods that help provide the controls, so these new
methods return this feature to the osgViewer fold and adds a few more
controls to boot. The extra controls can be found in
include/osgViewer/Renderer, and compliment the ones in the
DatabasePager, details are below.
In the longer term it would be best to deprecate these controls in
DatabasePager and Renderer and replace them with a single controller,
but for now I'll stick with these backwards compatible changes. For
2.6 and later we can think about a more centralised place for
controlling these parameters.
An svn update will get these changes.
Robert.
/** Set the target frame rate that the DatabasePager should assume.
* Typically one would set this to the value refresh rate of
your display system i.e. 60Hz.
* Default value is 100.
* Usage notes. The TargetFrameRate and the
MinimumTimeAvailableForGLCompileAndDeletePerFrame
* parameters are not directly used by DatabasePager, but are
should be used as a guide for how
* long to set aside per frame for compiling and deleting
OpenGL objects - ie. the value to use
* when calling
DatabasePager::compileGLObjectgs(state,availableTime,). The longer
amount of
* time to set aside cthe faster databases will be paged in
but with increased chance of frame drops,
* the lower the amount of time the set aside the slower
databases will paged it but with better
* chance of avoid any frame drops. The default values are
chosen to achieve the later when running
* on a modern mid to high end PC.
* The way to compute the amount of available time use a
scheme such as :
* availableTime = maximum(1.0/targetFrameRate -
timeTakenDuringUpdateCullAndDraw,
minimumTimeAvailableForGLCompileAndDeletePerFrame).
*
* Note, the actual TargetFrameRate used is the minimum of
this value and that set in the DatabasePager. */
void setTargetFrameRate(double tfr) { _targetFrameRate = tfr; }
/** Get the target frame rate that the DatabasePager should assume.*/
double getTargetFrameRate() const { return _targetFrameRate; }
/** Set the minimum amount of time (in seconds) that should be
made available for compiling and delete OpenGL objects per frame.
* Default value is 0.001 (1 millisecond).
* For usage see notes in setTargetFrameRate.
*
* Note, the actual TargetFrameRate used is the minimum of
this value and that set in the DatabasePager. */
void setMinimumTimeAvailableForGLCompileAndDeletePerFrame(double
ta) { _minimumTimeAvailableForGLCompileAndDeletePerFrame = ta; }
/** Get the minimum amount of time that should be made
available for compiling and delete OpenGL objects per frame.
* For usage see notes in setTargetFrameRate.*/
double getMinimumTimeAvailableForGLCompileAndDeletePerFrame()
const { return _minimumTimeAvailableForGLCompileAndDeletePerFrame; }
/** FlushTimeRatio governs how much of the spare time in each
frame is used for flushing deleted OpenGL objects.
* Default value is 0.5, valid range is 0.1 to 0.9.*/
void setFlushTimeRatio(double ratio) { _flushTimeRatio = ratio; }
double getFlushTimeRatio() const { return _flushTimeRatio; }
/** ConservativeTimeRatio governs how much of the measured
spare time in each frame is used for flushing deleted and compile new
OpenGL objects.
* Default value is 0.5, valid range is 0.1 to 1.0.
* A ratio near 1.0 will lead to paged databases being
compiled and merged quicker but increase the chances of frame drop.
* A ratio near 0.1 will lead to paged databases being
compiled and merged closer but reduse the chances of frame drop.*/
void setConservativeTimeRatio(double ratio) {
_conservativeTimeRatio = ratio; }
double getConservativeTimeRatio() const { return
_conservativeTimeRatio; }
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org