LWJGLException: Cannot apply pixel format to window

Started by mgianota, March 14, 2005, 14:54:16

Previous topic - Next topic

mgianota

I installed LWJGL-win32-0.95 on my machine and keep getting an
LWJGLException: Cannot apply pixel format to window
error when I try to run the org.lwjgl.test.* classes.

I'm assuming that the classes in the org.lwjgl.test package should work without exception, so is this error a problem with the library?

Thanks

--Mario

Matzon

most likely because your graphics card or its drivers don't do proper OpenGL

mgianota

An incompatible grafix card? S'funny, I have had no problems running LWJGL-0.94 with my current graphics card and driver. And all of the demos work just fine. It's just version 0.95 that I have the problem with.

I'm in the midst of writing a tutorial series on using LWJGL and I'd like to update the display creation lesson code to use LWJGL-0.95 which has a cleaner interface. For my own learning, I'm tracing all method calls used in my code through the LWJGL Java interface and into the JNI code.

Reading the JNI interface code that deals with display creation I see that you throw an LWJGLException if a suitable PIXELFORMAT can't be found. I'm afraid I haven't read enough of the code yet to understand exactly what its doing and I'd appreciate a few pointers, or links to reference documents. Other than an incompatible grafix card, can you tell me why the code might fail to find a PIXELFORMAT?

Cheers,

--Mario
P.S Great library

Matzon

hmm, if 0.94 worked and 0.95 doesn't then somewhing is wrong. If it fails on pixelformat, it might be because we default to another mode than we used to in 0.94 - that is another resolution/bpp/depth/alpha/stencil. Can you try an create the exact same mode by passing in a correct PixelFormat in the display constructor ?
What is your creation code for the tutorial ?

mgianota

I suspected that the problem was due to enabling an unsupported display mode. Do you enable stencil in 0.95 but not in 0.94? A lot of standard cards and drivers don't support this.

Anyway I'll lookup the 0.94 default mode and use it to construct a custom PixelFormat. Have to do this tonight though, 'cos I'm at work at the moment.

Thanks Brian

--Mario

jam007

Did you solve this problem?

One of my users got the same error:
org.lwjgl.LWJGLException: Could not apply pixel format to window
   at org.lwjgl.opengl.Win32Display.createWindow(Native Method)
   at org.lwjgl.opengl.Display.createWindow(Display.java:218)
   at org.lwjgl.opengl.Display.create(Display.java:533)
   at org.lwjgl.opengl.Display.create(Display.java:507)
   at iceboatgame.Game.displayAndGLInit(Game.java:392)

How do I write my code to minimize the risk that users get this problem?

Anders

BatKid

I once had this problem with my older graphics card (16 Meg voodoo) on 0.94.  It had to do with the default pixel format being something unsupported by the card.  I added a line to change the pixel format:

           PixelFormat p = new PixelFormat(0,bitdepth,0);
            Display.create(p);


where bitdepth is 16 (I also turned off the other two parameters).

This worked for my old graphics card.

Hope this helps.
Projects: 
   Env3D (http://env3d.org): Learn Java in 3D
   WhaleChat (http://whalechat.com): A 3D social programming experiment

jam007

thanks, will incorporate this as a fall back

Anders

mgianota

I still haven't managed to resolve this problem --even when I supply a custom PixelFormat which I know is compatible with my video card. What do you guys think it might be, a buggy video driver?

Thing is, LWJGL-0.94 works just fine. It's LWJGL-0.95 that causes the error. What has changed between those two releases that could cause the problem?

--Mario

elias

What is the exact OS and gfx card of the problematic machine? When 0.96 is coming out Really Soon Now, could you test with that? I don't expect the bug to disappear in 0.96, but at least we will have more or less synchronized code bases to debug from.

- elias

elias

And does it run in dual-monitor mode? If so, try disabling the aux monitor. Also, try both fullscreen and windowed mode and see if that makes a difference.

- elias