Added context sharing support.

This commit is contained in:
Robert Osfield
2007-02-15 12:24:04 +00:00
parent 4f2474ece8
commit 3fe4be6e70
6 changed files with 55 additions and 9 deletions

View File

@@ -259,7 +259,9 @@ class GraphicsContextCarbon : public osg::GraphicsContext
osg::notify(osg::WARN) << "GraphicsContext::realizeImplementation() aglChoosePixelFormat failed! " << aglErrorString(aglGetError()) << std::endl;
return false;
}
_context = aglCreateContext (pixelformat, NULL);
if (!_context) {
osg::notify(osg::WARN) << "GraphicsContext::realizeImplementation() aglCreateContext failed! " << aglErrorString(aglGetError()) << std::endl;
return false;
@@ -621,7 +623,17 @@ bool GraphicsWindowCarbon::realizeImplementation()
}
// create the context
_context = aglCreateContext (_pixelFormat, NULL);
GraphicsWindowCarbon* sharedContextCarbon = dynamic_cast<GraphicsWindowCarbon*>(_traits->sharedContext);
if (sharedContextCarbon)
{
_context = aglCreateContext (_pixelFormat, sharedContextCarbon->getAGLContext());
}
else
{
_context = aglCreateContext (_pixelFormat, NULL);
}
if (!_context) {
osg::notify(osg::WARN) << "GraphicsWindowCarbon::realizeImplementation failed creating a context: " << aglGetError() << std::endl;
return false;