24 bit troubles

Started by andrewc, June 11, 2003, 16:30:34

Previous topic - Next topic


While investigating my problems with running AF, I've been trying out the LWJGL examples in various modes. I have a few curious problems.

If my desktop is 16 bit colour, when I try to run an example in 24 bit (either windowed or fullscreen) I get an error looking like this
java.lang.Exception: Problem starting loop
        at BaseWindow.start(BaseWindow.java:170)
        at TextureMapping.main(TextureMapping.java:242)
Caused by: java.lang.Exception: Problem initialising Lesson
        at BaseWindow.createGLWindow(BaseWindow.java:136)
        at BaseWindow.start(BaseWindow.java:149)
        ... 1 more
Caused by: java.lang.Exception: This application requires a greater colour depth

        at org.lwjgl.opengl.BaseGL.nCreate(Native Method)
        at org.lwjgl.opengl.BaseGL.doCreate(Unknown Source)
        at org.lwjgl.opengl.GL.doCreate(Unknown Source)
        at org.lwjgl.Window.create(Unknown Source)
        at BaseWindow.createGLWindow(BaseWindow.java:124)
        ... 2 more

I am surprised that it doesn't set the mode correctly. With my desktop set to 24 bit, it starts up ok.

However, then it only runs properly in fullscreen. When run in a window, it just stays black. This isn't the clear color because I changed it. Any thoughts?


The black is the Windows HBRUSH used to paint the window rect by default.

It's doing more or less what it's asked to do: you've got a 16 bit desktop and insist on 24 bit, so it barfs and says there's a problem.

The GL driver is free to provide any mode provided it's at least as good as the one you ask for. If you've got a 32 bit desktop and ask GL for 16 bit, it'll give you 32 bit.

Which brings me to fixing the bug you found in AF that stopped it working on your machine: although I choose the displaymode based on whether you ask for 32 bit or not, which will get me lesser modes if your machine won't do 32 bit, I then foolishly asked GL to give me at least 32 bits even when you've only got a 16 bit display.

So that's fixed now :)

I'll upload a slew of fixes this weekend. Let's see how many more come to light.

Cas :)


Ok, so that's just me being dim :)


Ah! Problem solved. The example programs are missing calls to Display.setDisplayMode() and Display.resetDisplayMode().