diff --git a/src/osgViewer/CompositeViewer.cpp b/src/osgViewer/CompositeViewer.cpp index 9d21a09c7..ebede960d 100644 --- a/src/osgViewer/CompositeViewer.cpp +++ b/src/osgViewer/CompositeViewer.cpp @@ -639,14 +639,15 @@ void CompositeViewer::realize() } - startThreading(); - // initialize the global timer to be relative to the current time. osg::Timer::instance()->setStartTick(); // pass on the start tick to all the associated eventqueues setStartTick(osg::Timer::instance()->getStartTick()); + // configure threading. + setUpThreading(); + if (osg::DisplaySettings::instance()->getCompileContextsHint()) { int numProcessors = OpenThreads::GetNumberOfProcessors(); diff --git a/src/osgViewer/Viewer.cpp b/src/osgViewer/Viewer.cpp index ab4adb867..bd9b84787 100644 --- a/src/osgViewer/Viewer.cpp +++ b/src/osgViewer/Viewer.cpp @@ -587,6 +587,7 @@ void Viewer::realize() // pass on the start tick to all the associated event queues setStartTick(osg::Timer::instance()->getStartTick()); + // configure threading. setUpThreading(); if (osg::DisplaySettings::instance()->getCompileContextsHint()) diff --git a/src/osgViewer/ViewerBase.cpp b/src/osgViewer/ViewerBase.cpp index 425ee82dd..ea70af49b 100644 --- a/src/osgViewer/ViewerBase.cpp +++ b/src/osgViewer/ViewerBase.cpp @@ -177,6 +177,17 @@ void ViewerBase::setUpThreading() Scenes scenes; getScenes(scenes); + + for(Scenes::iterator scitr = scenes.begin(); + scitr != scenes.end(); + ++scitr) + { + if ((*scitr)->getSceneData()) + { + // update the scene graph so that it has enough GL object buffer memory for the graphics contexts that will be using it. + (*scitr)->getSceneData()->resizeGLObjectBuffers(osg::DisplaySettings::instance()->getMaxNumberOfGraphicsContexts()); + } + } } } }