diff --git a/src/osgViewer/CMakeLists.txt b/src/osgViewer/CMakeLists.txt index ef82fdc04..74cb02ac6 100644 --- a/src/osgViewer/CMakeLists.txt +++ b/src/osgViewer/CMakeLists.txt @@ -7,6 +7,7 @@ ELSE (DYNAMIC_OPENSCENEGRAPH) ENDIF(DYNAMIC_OPENSCENEGRAPH) SET(LIB_NAME osgViewer) + SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) SET(LIB_PUBLIC_HEADERS ${HEADER_PATH}/CompositeViewer @@ -39,6 +40,18 @@ SET(LIB_EXTRA_LIBS) IF(WIN32) + # + # Enable workaround for OpenGL driver issues when used in multithreaded/multiscreen with NVidia drivers on Windows XP + # For example: osgviewer dumptruck.osg was showing total garbage (screen looked like shattered, splashed hedgehog) + # There were also serious issues with render to texture cameras. + # Workaround repeats makeCurrentContext call as it was found that this causes the problems to dissapear. + # + OPTION(OSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND "Set to ON if you have NVidia board and drivers earlier than 177.92 ver" ON) + MARK_AS_ADVANCED(OSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND) + IF(OSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND) + ADD_DEFINITIONS(-DOSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND) + ENDIF(OSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND) + SET(LIB_PUBLIC_HEADERS ${LIB_PUBLIC_HEADERS} ${HEADER_PATH}/api/Win32/GraphicsWindowWin32 ${HEADER_PATH}/api/Win32/PixelBufferWin32 diff --git a/src/osgViewer/GraphicsWindowWin32.cpp b/src/osgViewer/GraphicsWindowWin32.cpp index 61e90852d..753313c48 100644 --- a/src/osgViewer/GraphicsWindowWin32.cpp +++ b/src/osgViewer/GraphicsWindowWin32.cpp @@ -1664,6 +1664,14 @@ bool GraphicsWindowWin32::makeCurrentImplementation() return false; } + // 2008/10/03 + // Few days ago NVidia released WHQL certified drivers ver 178.13. + // These drivers (as well as former beta ver 177.92) were free from the bug described below. + // So it looks like its high time to undef the workaround. + // If you happen to still use earlier drivers and have problems consider changing to new ones or + // activate OSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND macro def through CMake advanced vars. +#ifdef OSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND + // 2008/05/12 // Workaround for Bugs in NVidia drivers for windows XP / multithreaded / dualview / multicore CPU // affects GeForce 6x00, 7x00, 8x00 boards (others were not tested) driver versions 174.xx - 175.xx @@ -1688,6 +1696,7 @@ bool GraphicsWindowWin32::makeCurrentImplementation() return false; } } +#endif if (!::wglMakeCurrent(_hdc, _hglrc)) {