Feb 8, 2007 9:40:43 AM com.jme.app.BaseGame start
INFO: Application started.
Feb 8, 2007 9:40:43 AM com.jme.system.PropertiesIO <init>
INFO: PropertiesIO created
Feb 8, 2007 9:40:43 AM com.jme.system.PropertiesIO load
INFO: Read properties
Feb 8, 2007 9:40:45 AM com.jme.input.joystick.DummyJoystickInput <init>
INFO: Joystick support is disabled
Feb 8, 2007 9:40:45 AM com.jme.system.lwjgl.LWJGLDisplaySystem <init>
INFO: LWJGL Display System created.
Feb 8, 2007 9:40:45 AM com.jme.system.PropertiesIO save
INFO: Saved properties
Feb 8, 2007 9:40:45 AM com.jme.app.BaseSimpleGame initSystem
INFO: jME version 0.11 beta
Feb 8, 2007 9:40:45 AM com.jme.system.lwjgl.LWJGLDisplaySystem initDisplay
SEVERE: Cannot create window
com.jme.system.JmeException: Cannot create window: X Error - serial: 34, error_code: BadMatch (invalid parameter attributes), request_code: 42, minor_code: 0
at com.jme.system.lwjgl.LWJGLDisplaySystem.initDisplay(LWJGLDisplaySystem.java:394)
at com.jme.system.lwjgl.LWJGLDisplaySystem.createWindow(LWJGLDisplaySystem.java:141)
at com.jme.app.BaseSimpleGame.initSystem(BaseSimpleGame.java:338)
at com.jme.app.BaseGame.start(BaseGame.java:52)
at test.jme.demo5.Demo5.main(Demo5.java:31)
It's happening since my last "svn update", yesterday morning. I'm not sure if the "update" is the reason.
Such error occurs in any jME demo, personal apps, everything...
I was looking in the jME source.
It happens when the display tries to create the window, as we could see in the following jME function:
private void initDisplay() {
// create the Display.
DisplayMode mode = selectMode();
PixelFormat format = getFormat();
if ( null == mode ) {
throw new JmeException( "Bad display mode" );
}
try {
Display.setDisplayMode( mode );
Display.setFullscreen( fs );
if ( !fs ) {
int x, y;
x = ( Toolkit.getDefaultToolkit().getScreenSize().width - width ) >> 1;
y = ( Toolkit.getDefaultToolkit().getScreenSize().height - height ) >> 1;
Display.setLocation( x, y );
}
Display.create( format );
// kludge added here... LWJGL does not properly clear their
// keyboard and mouse buffers when you call the destroy method,
// so if you run two jme programs in the same jvm back to back
// the second one will pick up the esc key used to exit out of
// the first.
Keyboard.poll();
Mouse.poll();
The following keys are available:
ESCAPE: Exit test
ARROW Keys: Move window when in non-fullscreen mode
L: List selectable display modes
0-8: Selection of display modes
F: Toggle fullscreen
SHIFT-F: Toggle fullscreen with Display.destroy()/create() cycle
Found 30 display modes
Problem retrieving mode with 640x480x16@-1
Problem retrieving mode with 640x480x32@-1
Problem retrieving mode with 800x600x16@-1
Problem retrieving mode with 800x600x32@-1
Problem retrieving mode with 1024x768x16@-1
Problem retrieving mode with 1024x768x32@-1
org.lwjgl.LWJGLException: X Error - serial: 34, error_code: BadMatch (invalid parameter attributes), request_code: 42, minor_code: 0
at org.lwjgl.opengl.LinuxDisplay.nCreateWindow(Native Method)
at org.lwjgl.opengl.LinuxDisplay.createWindow(LinuxDisplay.java:393)
at org.lwjgl.opengl.Display.createWindow(Display.java:261)
at org.lwjgl.opengl.Display.create(Display.java:703)
at org.lwjgl.opengl.Display.create(Display.java:657)
at org.lwjgl.opengl.Display.create(Display.java:641)
at WindowCreationTest.initialize(WindowCreationTest.java:90)
at WindowCreationTest.main(WindowCreationTest.java:282)
DisplayTest.java
==== Test Current ====
Info about current:
Graphics card: null, version: null
Resolution: 1280x1024x24@75Hz
---- Test Current ----
==== Test query ====
Retrieving available displaymodes
Found 30 modes
The first 5 are:
640 x 400 x 24 @60Hz
1280 x 1024 x 24 @75Hz
320 x 200 x 24 @75Hz
640 x 480 x 24 @72Hz
640 x 480 x 24 @75Hz
1152 x 864 x 24 @75Hz
---- Test query ----
==== Test setDisplayMode ====
Retrieving available displaymodes
Looking for 640x480...found!
Changing to mode...error
FATAL: Error setting mode
I'm getting this error also. I'm on a MacBook Pro. On this system, all the LWJGL display modes have a frequency of 0.
In LWGJLDisplaySystem.getValidDisplayMode(), the mode search is looking for an exact freq match when the request freq != 0, as is the case with the default frequency. This seems rather constraining. In fact, I'm not sure why it tries to match freq, as opposed to selecting the highest freq that matches width, height, and bits per pixel.
Anm's patch doesn't fix the problem here. It's still happening when [red]com.jme.system.lwjgl.LWJGLDisplaySystem.initDisplay[/red] calls [red]Display.create(format)[/red]
Hmm, ok I'd never heard of such a requirement (swing dialog must be created from awt thread) before. It will take a little rejiggering to move all the gl calls out to the main thread (the only one done currently is the display mode validation since the rest was being done in the constructor and such called from main.)
More from me… I've managed to make some time tonight to implement and test a fix for moving all GL commands back to the main thread and starting the dialog with the awt EventQueue. I've tested it successfully locally, so let's see how it runs on other people's machines. Run a test like jmetest.shape.TestTube to validate. Part of the code (display mode validation) is not used if you are not running full screen, so please test windowed and full screen.