So, I was until recently using Ubuntu to development, and I got a good (not top-of-the-line) nVidia graphics card. All of my graphics significantly improved. The card was also able to share OpenGL contexts between different threads, something my old setup had been unable to do.
I switched back to Windows 7 because of some stability and ease-of-use issues with Ubuntu, and even though I've updated the nVidia driver to the latest the allow for download on their site, I'm not able to share contexts now. It's the exact same code on the exact same machine with the exact same graphics card, simply the OS is different (and thus, the driver is the windows version).
Am I missing something here? How do I fix this? Do I have to install additional OpenGL libraries or something?
Anyone at all?
A simple test that reproduces the problem would be helpful, though I doubt the problem is related to LWJGL.
Also, make sure the driver is working properly by checking the values of GL_RENDERER, GL_VENDOR and GL_VERSION.
The results are as expected:
Renderer: GeForce GTS 450/PCI/SSE2
Vendor: NVIDIA Corporation
Version: 4.1.0
As for a test case, here's the code I use to share contexts (called at the beginning of a separate thread):
/*************************************************************************
* Attempts to share contexts, settings the flag on either success or
* failure.
*************************************************************************/
protected void shareContext()
{
try
{
Drawable drawable = Display.getDrawable();
sharedDrawable = new SharedDrawable(drawable);
sharedDrawable.makeCurrent();
contextSharingResult = CONTEXT_SHARING_SUCCESS;
}
catch (LWJGLException e)
{
contextSharingResult = CONTEXT_SHARING_FAILURE;
e.printStackTrace();
}
}
Here is the exception I get:
org.lwjgl.LWJGLException: Could not create context (WGL_ARB_create_context)
at org.lwjgl.opengl.WindowsContextImplementation.nCreate(Native Method)
at org.lwjgl.opengl.WindowsContextImplementation.create(WindowsContextImplementation.java:50)
at org.lwjgl.opengl.Context.<init>(Context.java:131)
at org.lwjgl.opengl.AbstractDrawable.createSharedContext(AbstractDrawable.java:30)
at org.lwjgl.opengl.SharedDrawable.<init>(SharedDrawable.java:50)
at org.jrabbit.base.data.thread.WatchableGLThread.shareContext(WatchableGLThread.java:76)
at org.jrabbit.base.data.thread.WatchableGLThread.run(WatchableGLThread.java:58)
The code is designed to still work if context sharing fails; it simply loads everything in a main thread. This means I have to render my nicely animated loading screen as static, however, and I still feel like I should get this functionality to work if my card is designed to support it.
Additionally, I downloaded the OpenGL Extensions Viewer and it says that I support WGL_ARB_create_context. Now I'm really confused.
Could you try the org.lwjgl.test.opengl.multithread.BackgroundLoadTest sample in the LWJGL test package?
I cannot Background loading fails, with either PBuffers or SharedDrawables.
The card in question is a GeForce GTS 450, btw.
So... is this an OpenGL issue, an OS issue, a driver issue, or an LWJGL issue?
Try to find a non-LWJGL demo that does context sharing and see if that works. If it does, then it's an LWJGL issue, if not, probably a driver one.
Do you know where I can find one? I've been Googling such a thing, but haven't come across any.