# Slick 2D first trial error

I followed some advices to learn Slick2D and when I started doing the "SimpleGame" I got my first error. Does anyone have any idea of what is it and how to fix?

Sun Dec 26 23:09:12 GMT-03:00 2010 INFO:Slick Build #274
Sun Dec 26 23:09:12 GMT-03:00 2010 INFO:LWJGL Version: 2.0b1
Sun Dec 26 23:09:12 GMT-03:00 2010 INFO:OriginalDisplayMode: 1024 x 768 x 16 @60Hz
Sun Dec 26 23:09:12 GMT-03:00 2010 INFO:TargetDisplayMode: 800 x 600 x 0 @0Hz
Sun Dec 26 23:09:12 GMT-03:00 2010 ERROR:Could not find a valid pixel format
org.lwjgl.LWJGLException: Could not find a valid pixel format
at org.lwjgl.opengl.WindowsPeerInfo.nChoosePixelFormat(Native Method)
at org.lwjgl.opengl.WindowsPeerInfo.choosePixelFormat(WindowsPeerInfo.java:52)
at org.lwjgl.opengl.WindowsDisplayPeerInfo.initDC(WindowsDisplayPeerInfo.java:54)
at org.lwjgl.opengl.WindowsDisplay.createWindow(WindowsDisplay.java:158)
at org.lwjgl.opengl.Display.createWindow(Display.java:299)
at org.lwjgl.opengl.Display.create(Display.java:848)
at org.lwjgl.opengl.Display.create(Display.java:800)
at org.newdawn.slick.AppGameContainer.tryCreateDisplay(AppGameContainer.java:299)
at org.newdawn.slick.AppGameContainer.access$000(AppGameContainer.java:34) at org.newdawn.slick.AppGameContainer$2.run(AppGameContainer.java:364)
at java.security.AccessController.doPrivileged(Native Method)
at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:345)
at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:314)
at SimpleGame.main(SimpleGame.java:38)
Exception in thread "main" org.newdawn.slick.SlickException: Failed to initialise the LWJGL display
at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:375)
at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:314)
at SimpleGame.main(SimpleGame.java:38)


Did a quick Bing search and got the following forum post and another one. Note that the problem is Failed to initialise the LWJGL display and according to both forums this could be fixed by adding the following line:

-Dorg.lwjgl.opengl.Display.allowSoftwareOpenGL=true


to the VM Arguments of your IDE. I am not a Java developer, so I am not sure if this is the best way to do this.

• I'll try that too. Thanks! ps: didn't know people use Bing to search instead of google – pringlesinn Dec 27 '10 at 17:03
• @pringlesinn I actually use both search engines. I have been mostly using Bing recently, but sometimes switch to Google when I don't get good results for a certain query :) – Waleed Al-Balooshi Dec 27 '10 at 18:39
• @pringlesinn I am happy everything worked out and good luck with learning Slick2D :) – Waleed Al-Balooshi Dec 27 '10 at 21:14
• This doesn't seem like a great idea, software OpenGL is too slow for anything other than quick experiments. – user744 Dec 27 '10 at 23:44
• @Joe Wreschnig @pringlesinn you are correct Joe. The original problem seems to be that the OpenGL Hardware drivers are probably not installed properly. This is more of a partial fix while he is using it for learning purposes. The solution came from a moderator on the LWJGL forum though, which led me to believe that this might be an acceptable solution for now. – Waleed Al-Balooshi Dec 28 '10 at 7:03

I am totally unfamiliar with Slick2D, but it looks like you're requesting a 800x600 fullscreen resolution when your monitor / video card only supports 1024x768.

• Once I get home I'll try it, and I'll let you know. – pringlesinn Dec 27 '10 at 14:52