From ed01ae93879ff37f5d05b94a01c023e7ef2d89e2 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 15 Feb 2007 14:04:22 +0000 Subject: [PATCH] =?UTF-8?q?From=20Andr=C3=A9=20Garneau,=20Win32=20build=20?= =?UTF-8?q?fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/osgViewer/GraphicsWindowWin32 | 2 +- src/osgViewer/GraphicsWindowWin32.cpp | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/osgViewer/GraphicsWindowWin32 b/include/osgViewer/GraphicsWindowWin32 index 6688256b3..24da74e52 100644 --- a/include/osgViewer/GraphicsWindowWin32 +++ b/include/osgViewer/GraphicsWindowWin32 @@ -98,7 +98,7 @@ class GraphicsWindowWin32 : public osgViewer::GraphicsWindow int getScreenNumberContainingWindow( int& _screenOriginX, int& _screenOriginY ); - HGLRC& getWGLContext() { return _hglrc; } + HGLRC getWGLContext() { return _hglrc; } HWND _hwnd; HDC _hdc; diff --git a/src/osgViewer/GraphicsWindowWin32.cpp b/src/osgViewer/GraphicsWindowWin32.cpp index 4a60558ed..00dca8427 100644 --- a/src/osgViewer/GraphicsWindowWin32.cpp +++ b/src/osgViewer/GraphicsWindowWin32.cpp @@ -1411,13 +1411,17 @@ bool GraphicsWindowWin32::realizeImplementation() init(); if (!_initialized) return false; - if (_traits.valid && _traits->sharedContext) + if (_traits.valid() && _traits->sharedContext) { GraphicsWindowWin32* sharedContextWin32 = dynamic_cast(_traits->sharedContext); if (sharedContextWin32) { - makeCurrent(); - wglShareLists( sharedContextWin32->getWGLContext(), getWGLContext() ); + if (!makeCurrent()) return false; + if (!wglShareLists(sharedContextWin32->getWGLContext(), getWGLContext())) + { + reportErrorForScreen("GraphicsWindowWin32::realizeImplementation() - Unable to share OpenGL context", _traits->screenNum, ::GetLastError()); + return false; + } } } }