OpenSceneGraph 2.8.3

osgViewer::Renderer Class Reference

Inheritance diagram for osgViewer::Renderer:

List of all members.

Classes

struct  ThreadSafeQueue

Public Member Functions

 Renderer (osg::Camera *camera)
osgUtil::SceneViewgetSceneView (unsigned int i)
void setDone (bool done)
bool getDone ()
void setGraphicsThreadDoesCull (bool flag)
bool getGraphicsThreadDoesCull () const
virtual void cull ()
virtual void draw ()
virtual void cull_draw ()
virtual void compile ()
void setCompileOnNextDraw (bool flag)
bool getCompileOnNextDraw () const
virtual void operator() (osg::Object *object)
 Override the standard Operation operator and dynamic cast object to a GraphicsContext, on success call operation()(GraphicsContext*).
virtual void operator() (osg::GraphicsContext *context)
virtual void release ()
 if this operation is a barrier then release it.
void setTargetFrameRate (double tfr)
 Set the target frame rate that the DatabasePager should assume.
double getTargetFrameRate () const
 Get the target frame rate that the DatabasePager should assume.
void setMinimumTimeAvailableForGLCompileAndDeletePerFrame (double ta)
 Set the minimum amount of time (in seconds) that should be made available for compiling and delete OpenGL objects per frame.
double getMinimumTimeAvailableForGLCompileAndDeletePerFrame () const
 Get the minimum amount of time that should be made available for compiling and delete OpenGL objects per frame.
void setFlushTimeRatio (double ratio)
 FlushTimeRatio governs how much of the spare time in each frame is used for flushing deleted OpenGL objects.
double getFlushTimeRatio () const
void setConservativeTimeRatio (double ratio)
 ConservativeTimeRatio governs how much of the measured spare time in each frame is used for flushing deleted and compile new OpenGL objects.
double getConservativeTimeRatio () const

Protected Member Functions

virtual ~Renderer ()
virtual void updateSceneView (osgUtil::SceneView *sceneView)
virtual void flushAndCompile (double currentElapsedFrameTime, osgUtil::SceneView *sceneView, osgDB::DatabasePager *databasePager, osg::GraphicsThread *compileThread)

Protected Attributes

double _targetFrameRate
double _minimumTimeAvailableForGLCompileAndDeletePerFrame
double _flushTimeRatio
double _conservativeTimeRatio
osg::observer_ptr< osg::Camera_camera
bool _done
bool _graphicsThreadDoesCull
bool _compileOnNextDraw
osg::ref_ptr< osgUtil::SceneView_sceneView [2]
osg::ref_ptr
< osg::FlushDeletedGLObjectsOperation
_flushOperation
ThreadSafeQueue _availableQueue
ThreadSafeQueue _drawQueue

Constructor & Destructor Documentation

osgViewer::Renderer::Renderer ( osg::Camera camera)
virtual osgViewer::Renderer::~Renderer ( ) [protected, virtual]

Member Function Documentation

virtual void osgViewer::Renderer::compile ( ) [virtual]
virtual void osgViewer::Renderer::cull ( ) [virtual]
virtual void osgViewer::Renderer::cull_draw ( ) [virtual]
virtual void osgViewer::Renderer::draw ( ) [virtual]
virtual void osgViewer::Renderer::flushAndCompile ( double  currentElapsedFrameTime,
osgUtil::SceneView sceneView,
osgDB::DatabasePager databasePager,
osg::GraphicsThread compileThread 
) [protected, virtual]
bool osgViewer::Renderer::getCompileOnNextDraw ( ) const [inline]
double osgViewer::Renderer::getConservativeTimeRatio ( ) const [inline]
bool osgViewer::Renderer::getDone ( ) [inline]
double osgViewer::Renderer::getFlushTimeRatio ( ) const [inline]
bool osgViewer::Renderer::getGraphicsThreadDoesCull ( ) const [inline]
double osgViewer::Renderer::getMinimumTimeAvailableForGLCompileAndDeletePerFrame ( ) const [inline]

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.

osgUtil::SceneView* osgViewer::Renderer::getSceneView ( unsigned int  i) [inline]
double osgViewer::Renderer::getTargetFrameRate ( ) const [inline]

Get the target frame rate that the DatabasePager should assume.

virtual void osgViewer::Renderer::operator() ( osg::Object object) [virtual]

Override the standard Operation operator and dynamic cast object to a GraphicsContext, on success call operation()(GraphicsContext*).

Reimplemented from osg::GraphicsOperation.

virtual void osgViewer::Renderer::operator() ( osg::GraphicsContext context) [virtual]
virtual void osgViewer::Renderer::release ( ) [virtual]

if this operation is a barrier then release it.

Reimplemented from osg::Operation.

void osgViewer::Renderer::setCompileOnNextDraw ( bool  flag) [inline]
void osgViewer::Renderer::setConservativeTimeRatio ( double  ratio) [inline]

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 osgViewer::Renderer::setDone ( bool  done) [inline]
void osgViewer::Renderer::setFlushTimeRatio ( double  ratio) [inline]

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 osgViewer::Renderer::setGraphicsThreadDoesCull ( bool  flag)
void osgViewer::Renderer::setMinimumTimeAvailableForGLCompileAndDeletePerFrame ( double  ta) [inline]

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 osgViewer::Renderer::setTargetFrameRate ( double  tfr) [inline]

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.

virtual void osgViewer::Renderer::updateSceneView ( osgUtil::SceneView sceneView) [protected, virtual]

Member Data Documentation

bool osgViewer::Renderer::_done [protected]

The documentation for this class was generated from the following file:

osg logo
Generated at Tue Mar 22 2011 13:20:31 for the OpenSceneGraph by doxygen 1.7.3.