diff --git a/src/osgProducer/GraphicsContextImplementation.cpp b/src/osgProducer/GraphicsContextImplementation.cpp index 422af787b..0954ba433 100644 --- a/src/osgProducer/GraphicsContextImplementation.cpp +++ b/src/osgProducer/GraphicsContextImplementation.cpp @@ -54,6 +54,9 @@ GraphicsContextImplementation::GraphicsContextImplementation(Traits* traits) _rs->setWindowName(traits->_windowName); _rs->setWindowRectangle(traits->_x, traits->_y, traits->_width, traits->_height); _rs->useBorder(traits->_windowDecoration); + _rs->setDisplayNum(traits->_displayNum); + _rs->setScreenNum(traits->_screenNum); + // set the visual chooser Producer::VisualChooser* rs_vc = _rs->getVisualChooser(); @@ -164,6 +167,11 @@ GraphicsContextImplementation::GraphicsContextImplementation(Producer::RenderSur { _rs = rs; _closeOnDestruction = false; + + _traits = new osg::GraphicsContext::Traits; + _traits->_windowName = _rs->getWindowName(); + _traits->_displayNum = _rs->getDisplayNum(); + _traits->_screenNum = _rs->getScreenNum(); } GraphicsContextImplementation::~GraphicsContextImplementation() @@ -183,6 +191,8 @@ bool GraphicsContextImplementation::realizeImplementation() } else { + osg::notify(osg::NOTICE)<<"GraphicsContextImplementation::realize"<realize(); } return _rs->isRealized(); diff --git a/src/osgUtil/RenderStage.cpp b/src/osgUtil/RenderStage.cpp index 4823d8739..e3a87bc2e 100644 --- a/src/osgUtil/RenderStage.cpp +++ b/src/osgUtil/RenderStage.cpp @@ -519,6 +519,13 @@ void RenderStage::runCameraSetUp(osg::State& state) if (state.getGraphicsContext()) { traits->_sharedContext = state.getGraphicsContext(); + + const osg::GraphicsContext::Traits* sharedTraits = traits->_sharedContext->getTraits(); + if (sharedTraits) + { + traits->_displayNum = sharedTraits->_displayNum; + traits->_screenNum = sharedTraits->_screenNum; + } } // create the graphics context according to these traits.