Added basic support for DatabasePager into osgViewer::Viewer

This commit is contained in:
Robert Osfield
2006-12-21 17:23:07 +00:00
parent 4fc9af7ea0
commit 28fb22568c
2 changed files with 33 additions and 9 deletions

View File

@@ -266,10 +266,17 @@ void Viewer::frameUpdateTraversal()
void Viewer::frameRenderingTraversals()
{
if (_done) return;
if (_done) return;
typedef std::set<osg::GraphicsContext*> GraphicsContexts;
GraphicsContexts contexts;
osgDB::DatabasePager* dp = _scene->getDatabasePager();
if (dp)
{
dp->signalBeginFrame(_scene->getFrameStamp());
}
typedef std::set<osg::GraphicsContext*> GraphicsContexts;
GraphicsContexts contexts;
if (_camera.valid() && _camera->getGraphicsContext())
{
@@ -292,6 +299,7 @@ void Viewer::frameRenderingTraversals()
}
}
}
for(GraphicsContexts::iterator itr = contexts.begin();
itr != contexts.end();
@@ -301,13 +309,19 @@ void Viewer::frameRenderingTraversals()
const_cast<osg::GraphicsContext*>(*itr)->makeCurrent();
const_cast<osg::GraphicsContext*>(*itr)->runOperations();
}
for(GraphicsContexts::iterator itr = contexts.begin();
itr != contexts.end();
++itr)
{
const_cast<osg::GraphicsContext*>(*itr)->swapBuffers();
}
if (dp)
{
dp->signalEndFrame();
}
}
void Viewer::releaseAllGLObjects()