unable to create display for some LWJGL apps

Started by NateS, November 29, 2012, 01:19:46

Previous topic - Next topic

NateS

I'm using libgdx and I'm having an issue with "Pixel format not accelerated" being thrown creating the display. The user says other LWJGL apps work. I don't have access to the machine, unfortunately. Here is some info:

Windows XP
GPU: Nvidia NVS 300
Sys.getVersion: 2.9.0
Java 1.7.0_07
Oracle Corporation
Java HotSpot(TM) Client VM

Exception:
Quotecom.badlogic.gdx.utils.GdxRuntimeException: com.badlogic.gdx.utils.GdxRuntimeException: OpenGL is not supported by the video driver.
   at com.badlogic.gdx.backends.lwjgl.LwjglCanvas.create(LwjglCanvas.java:175)
   at com.badlogic.gdx.backends.lwjgl.LwjglCanvas$1$1.run(LwjglCanvas.java:71)
   at java.awt.event.InvocationEvent.dispatch(Unknown Source)
   at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
   at java.awt.EventQueue.access$200(Unknown Source)
   at java.awt.EventQueue$3.run(Unknown Source)
   at java.awt.EventQueue$3.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: OpenGL is not supported by the video driver.
   at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.createDisplayPixelFormat(LwjglGraphics.java:221)
   at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.setupDisplay(LwjglGraphics.java:181)
   at com.badlogic.gdx.backends.lwjgl.LwjglCanvas.create(LwjglCanvas.java:167)
   ... 15 more
Caused by: org.lwjgl.LWJGLException: Pixel format not accelerated
   at org.lwjgl.opengl.WindowsPeerInfo.nChoosePixelFormat(Native Method)
   at org.lwjgl.opengl.WindowsPeerInfo.choosePixelFormat(WindowsPeerInfo.java:52)
   at org.lwjgl.opengl.WindowsDisplay.createWindow(WindowsDisplay.java:229)
   at org.lwjgl.opengl.Display.createWindow(Display.java:303)
   at org.lwjgl.opengl.Display.create(Display.java:845)
   at org.lwjgl.opengl.Display.create(Display.java:754)
   at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.createDisplayPixelFormat(LwjglGraphics.java:209)
   ... 17 more

LwjglGraphics.createDisplayPixelFormat is here:
https://github.com/libgdx/libgdx/blob/master/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/lwjgl/LwjglGraphics.java#L187
It tries to create the display three ways, then fails. Is this the best way for libgdx to setup the display? It is odd other LWJGL apps work but this fails.

NateS

I'll try using Display.create() with no args if the existing three tries fail.

kappa

IIRC from the JGO thread, you are mixing with AWT, you could try add the following VM args to disable AWT hardware acceleration:

-Dsun.java2d.noddraw=true -Dsun.awt.noerasebackground=true -Dsun.java2d.d3d=false -Dsun.java2d.opengl=false -Dsun.java2d.pmoffscreen=false


Its a long shot but the problem could be related to AWT starting its own accelerated pipeline which due to weak drivers breaks further accelerated pipelines.

NateS

Good idea. Do you know if it is possible to set these first thing in my app, or do I have to pass them on the command line?

kappa

They should work if you set them before any AWT starts (although not entirely sure), if possible, just stick them as vm args to be 100% sure.

NateS

Some users are still having this problem even after using the suggested system properties (via vmargs).

Is the code linked in the first post the best way to create the display?

Edit: I got a little more information. It seems this only happens when Display.setParent is used. Does that help at all?

kappa

Now that you mention it, I seem to recall that I may have run into this Display.setParent() issue before, not exactly sure what the root cause of the problem is and why it only happens on some rare drivers, but as a workaround you could try the following in the libgdx code linked above, change line 183

from

createDisplayPixelFormat();


to

try {
            createDisplayPixelFormat();
         } catch (LWJGLException e) {
            e.printStackTrace();
            // failed to create Display, apply workaround (sleep for 1 second) and try again
            Thread.sleep(1000);
            createDisplayPixelFormat();
         }


hopefully it should work after that.

NateS

Unfortunately that didn't seem to fix it. The user has Win XP SP 3 with a GeForce 250 GTS and other libgdx apps work for him (presumably because they don't use setParent). I'm creating the display on the EDT because it simplifies threading. Maybe I'll make the second try after letting the EDT thread go for 1s...