Added DisplaySetting::s/getCompileContextHint() and use of this hint in osgViewer::Viewer/CompositeViewer.

Removed the CustomViewer in osgterrain example as the above now removes the need for it.
This commit is contained in:
Robert Osfield
2007-08-11 14:49:14 +00:00
parent 4cd437d7d4
commit d57a16e023
8 changed files with 93 additions and 65 deletions

View File

@@ -597,6 +597,27 @@ void CompositeViewer::realize()
// pass on the start tick to all the associated eventqueues
setStartTick(osg::Timer::instance()->getStartTick());
if (osg::DisplaySettings::instance()->getCompileContextsHint())
{
int numProcessors = OpenThreads::GetNumberOfProcessors();
int processNum = 0;
for(unsigned int i=0; i<= osg::GraphicsContext::getMaxContextID(); ++i)
{
osg::GraphicsContext* gc = osg::GraphicsContext::getOrCreateCompileContext(i);
if (gc)
{
gc->createGraphicsThread();
gc->getGraphicsThread()->setProcessorAffinity(processNum % numProcessors);
gc->getGraphicsThread()->startThread();
++processNum;
}
}
}
}