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

@@ -43,8 +43,17 @@ class GraphicsWindowCarbon : public osgViewer::GraphicsWindow
if (valid())
{
setState( new osg::State );
getState()->setContextID( osg::GraphicsContext::createNewContextID() );
getState()->setGraphicsContext(this);
if (_traits.valid() && _traits->sharedContext)
{
getState()->setContextID( _traits->sharedContext->getState()->getContextID() );
incrementContextIDUsageCount( getState()->getContextID() );
}
else
{
getState()->setContextID( osg::GraphicsContext::createNewContextID() );
}
}
}
@@ -95,6 +104,7 @@ class GraphicsWindowCarbon : public osgViewer::GraphicsWindow
void transformMouseXY(float& x, float& y);
AGLContext& getAGLContext() { return _context; }
bool _valid;
bool _initialized;

View File

@@ -98,6 +98,8 @@ class GraphicsWindowWin32 : public osgViewer::GraphicsWindow
int getScreenNumberContainingWindow( int& _screenOriginX, int& _screenOriginY );
HGLRC& getWGLContext() { return _hglrc; }
HWND _hwnd;
HDC _hdc;
HGLRC _hglrc;

View File

@@ -116,7 +116,7 @@ class GraphicsWindowX11 : public osgViewer::GraphicsWindow
Display* getEventDisplay() { return _eventDisplay; }
Window& getParent() { return _parent; }
Window& getWindow() { return _window; }
GLXContext getGLXContext() { return _glxContext; }
GLXContext& getGLXContext() { return _glxContext; }
Cursor& getDefaultCursor() { return _defaultCursor; }
Cursor& getNullCursor() { return _nullCursor; }