diff --git a/include/osgDB/DatabasePager b/include/osgDB/DatabasePager index 7b5e9fc57..8b0405480 100644 --- a/include/osgDB/DatabasePager +++ b/include/osgDB/DatabasePager @@ -305,12 +305,12 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl /** Compile the rendering objects (display lists,texture objects, VBO's) on loaded subgraph. * note, should only be called from the draw thread. * Note, must only be called from a valid graphics context. */ - virtual void compileGLObjects(osg::State& state,double& availableTime); + virtual void compileGLObjects(osg::State& state,double& availableTime, bool doFlush = false); /** Compile the rendering objects (display lists,texture objects, VBO's) on loaded subgraph. * note, should only be called from the draw thread. * Note, must only be called from a valid graphics context. */ - virtual void compileAllGLObjects(osg::State& state); + virtual void compileAllGLObjects(osg::State& state, bool doFlush = false); /** Report how many items are in the _fileRequestList queue */ unsigned int getFileRequestListSize() const { return _fileRequestQueue->size() + _httpRequestQueue->size(); } diff --git a/src/osgDB/DatabasePager.cpp b/src/osgDB/DatabasePager.cpp index e56203eb4..794e2a3c9 100644 --- a/src/osgDB/DatabasePager.cpp +++ b/src/osgDB/DatabasePager.cpp @@ -2026,7 +2026,7 @@ void DatabasePager::CompileOperation::operator () (osg::GraphicsContext* context { // OSG_NOTICE<<"Background thread compiling"<compileAllGLObjects(*(context->getState())); + if (_databasePager.valid()) _databasePager->compileAllGLObjects(*(context->getState()), true); } @@ -2037,13 +2037,13 @@ bool DatabasePager::requiresExternalCompileGLObjects(unsigned int contextID) con return osg::GraphicsContext::getCompileContext(contextID)==0; } -void DatabasePager::compileAllGLObjects(osg::State& state) +void DatabasePager::compileAllGLObjects(osg::State& state, bool doFlush) { double availableTime = DBL_MAX; - compileGLObjects(state, availableTime); + compileGLObjects(state, availableTime, doFlush); } -void DatabasePager::compileGLObjects(osg::State& state, double& availableTime) +void DatabasePager::compileGLObjects(osg::State& state, double& availableTime, bool doFlush) { // OSG_NOTICE<<"DatabasePager::compileGLObjects "<<_frameNumber<