diff --git a/src/osgProducer/OsgCameraGroup.cpp b/src/osgProducer/OsgCameraGroup.cpp index 9d358a6a1..f89f84f97 100644 --- a/src/osgProducer/OsgCameraGroup.cpp +++ b/src/osgProducer/OsgCameraGroup.cpp @@ -538,39 +538,63 @@ bool OsgCameraGroup::realize() } setUpSceneViewsWithData(); - - if (getTopMostSceneData()) + + // if we are multi-threaded check to see if particle exists in the scene + // if so we need to disable multi-threading of cameras. + if (_thread_model == Producer::CameraGroup::ThreadPerCamera) { - SearchForSpecialNodes sfsn; - getTopMostSceneData()->accept(sfsn); - if (sfsn._foundParticles) + if (getTopMostSceneData()) { - osg::notify(osg::INFO)<<"Warning: disabling multi-threading of cull and draw"< renderSurfaceSet; - for( unsigned int i = 0; i < _cfg->getNumberOfCameras(); i++ ) + SearchForSpecialNodes sfsn; + getTopMostSceneData()->accept(sfsn); + if (sfsn._foundParticles) { - Producer::Camera *cam = _cfg->getCamera(i); - renderSurfaceSet.insert(cam->getRenderSurface()); - } - if (renderSurfaceSet.size()!=_cfg->getNumberOfCameras()) - { - // camera's must be sharing a RenderSurface, so we need to ensure that we're - // running single threaded, to avoid OpenGL threading issues. - osg::notify(osg::INFO)<<"Warning: disabling multi-threading of cull and draw to avoid"< renderSurfaceSet; + for( unsigned int i = 0; i < _cfg->getNumberOfCameras(); i++ ) + { + Producer::Camera *cam = _cfg->getCamera(i); + renderSurfaceSet.insert(cam->getRenderSurface()); + } + if (renderSurfaceSet.size()!=_cfg->getNumberOfCameras()) + { + // camera's must be sharing a RenderSurface, so we need to ensure that we're + // running single threaded, to avoid OpenGL threading issues. + osg::notify(osg::INFO)<<"Warning: disabling multi-threading of cull and draw to avoid"<1 && RenderSurface::allGLContextsAreShared()) + { + // we have multiple RenderSurface, but with share contexts, which is dangerous for multi-threaded usage, + // so need to disable multi-threading to prevent problems. + osg::notify(osg::INFO)<<"Warning: disabling multi-threading of cull and draw to avoid"<