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:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user