LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: Lintu on March 07, 2012, 01:54:42

Title: org.lwjgl.LWJGLException: Could not create context
Post by: Lintu on March 07, 2012, 01:54:42
Hey,

I worked out a working project with LWJGL now. Then I copied the same project to my laptop to be able to work there too, but I can't get the program started with eclipse! I get the following error:

org.lwjgl.LWJGLException: Could not create context
at org.lwjgl.opengl.WindowsContextImplementation.nCreate(Native Method)
at org.lwjgl.opengl.WindowsContextImplementation.create(WindowsContextImplementation.java:50)
at org.lwjgl.opengl.ContextGL.<init>(ContextGL.java:132)
at org.lwjgl.opengl.Display.create(Display.java:875)
at org.lwjgl.opengl.Display.create(Display.java:782)
at org.lwjgl.opengl.Display.create(Display.java:764)
at core.GameWindow.startRendering(GameWindow.java:205)
at core.Game.<init>(Game.java:228)
at core.Game.main(Game.java:1335)


The responsible line in the GameWindow is:

Display.create();

The DisplayMode is set as follows (without any exception being thrown):

private boolean setDisplayMode() {
try {
DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(
width, height, -1, -1, -1, -1, 60, 60);
org.lwjgl.util.Display.setDisplayMode(dm, new String[] {
"width=" + width,
"height=" + height,
"freq=" + fps,
"bpp="
+ org.lwjgl.opengl.Display.getDisplayMode()
.getBitsPerPixel() });
// Display.setDisplayMode(new DisplayMode(width, height));
return true;
} catch (Exception e) {
e.printStackTrace();
System.out.println("Unable to set display mode");
}
return false;
}


So the game is usually launching on "800x600x32" with 60 fps (I also tried to set it down to 640x400x16, same error!)


I copied the project by using a subversion, so actually all the project with all the settings are on the laptop. I double-checked if the libraries are correctly set in eclipse, everything is fine with them (also checked native path for lwjgl.jar, it's alright).


So what could the error be about? What else could I test?

I use eclipse on both machines, both are running Windows7. My laptop is running only a 32bit CPU and a 32bit OS, is that the problem? My desktop computer has Win7 64bit.

What else may I check in order to get this issue solved?
Title: Re: org.lwjgl.LWJGLException: Could not create context
Post by: Fool Running on March 07, 2012, 13:56:48
What CPU/graphics card/how much memory does it have? It almost sounds like it can't handle running Eclipse and the game at the same time. :-\
Title: Re: org.lwjgl.LWJGLException: Could not create context
Post by: princec on March 07, 2012, 15:14:31
No it just sounds like it's picking a display mode that it can't actually create. Try windowed mode.

Cas :)
Title: Re: org.lwjgl.LWJGLException: Could not create context
Post by: Lintu on March 07, 2012, 20:53:51
The system should be fine, RAM is enough and CPU too. The graphics card is only a on-board intel chip, but that should actually do it too.


By "windowed" mode you just mean non-fullscreen, right? I'm not using fullscreen though.

And I have also tried this displaymode:

Display.setDisplayMode(new DisplayMode(600, 480));

and its not working either, so i actually doubt that its about the display mode.


What else could I try?
Title: Re: org.lwjgl.LWJGLException: Could not create context
Post by: princec on March 07, 2012, 22:37:17
Getting drivers that work I think will do the trick - just sounds like you have broken ones.

Cas :)