Fixed pbuffer usage cross multiple graphics contexts

This commit is contained in:
Robert Osfield
2006-08-11 11:05:09 +00:00
parent dd85c271a9
commit d1fe85caf6
2 changed files with 17 additions and 0 deletions

View File

@@ -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"<<std::endl;
_rs->realize();
}
return _rs->isRealized();

View File

@@ -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.