Hello Guest

24 bit troubles

  • 3 Replies
24 bit troubles
« on: June 11, 2003, 16:30:34 »
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
Code: [Select]
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?


Offline princec

  • *****
  • 1933
    • Puppygames
24 bit troubles
« Reply #1 on: June 11, 2003, 16:57:59 »
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 :)

24 bit troubles
« Reply #2 on: June 12, 2003, 21:05:25 »
Ok, so that's just me being dim :)

24 bit troubles
« Reply #3 on: June 13, 2003, 08:06:07 »
Ah! Problem solved. The example programs are missing calls to Display.setDisplayMode() and Display.resetDisplayMode().