Juce OpenGL Context sharing can fail when special pixel format are provided.
In my case on a Win7-64-SP1 Nvidia GTX295 WHQL driver 301.42:
If I share a default value OpenGLPixelFormat context with another context with a OpenGLPixelFormat.depthBufferBits value set to 32.
Context creation will succeed with the 7 pixel format for the first context and 97 for the second one. But wglShareLists call will fail.
The problem is due to the missing specification of the WGL_ACCELERATION_ARB attribute value on wglChoosePixelFormatARB call:
The first context is created by an ICD OpenGL driver, the second by an MCD OpenGL driver.
Context sharing on Window is allowed only if they use the same implementation of OpenGL function.
(CF MSDN wglShareLists doc)
A quick way to solve this problem is to enforce usage of full accelerated driver (ICD OpenGL driver) and make wglChoosePixelFormatExtension fail if requested pixel format is not available in full acceleration mode.
By adding the following line in juce::OpenGLContext::NativeContext::wglChoosePixelFormatExtension() method
atts[n++] = WGL_ACCELERATION_ARB; atts[n++] = WGL_FULL_ACCELERATION_ARB;
Another way is to add a bool in OpenGLPixelFormat class, allowing caller to choose acceleration mode. But this second way is probably not fully cross platform.
Thanks for your concern about this issue.