From b1aedf30e0a12401f6521876ab0e0dc5f02e6ffb Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 9 Aug 2010 16:19:50 +0000 Subject: [PATCH] Aded option for doing a glFlush() after compiling texture objects, with a dedicated compile thread default to issuing the glFlush. --- include/osgDB/DatabasePager | 4 ++-- src/osgDB/DatabasePager.cpp | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) 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<