LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: emanon on March 24, 2008, 23:30:14

Title: IllegalStateException: Mouse must be created.
Post by: emanon on March 24, 2008, 23:30:14
Hi all.

When trying to create an lwjgl binding with the following line.
disp = new Display(new LWJGLBinding());

This line throws the title exception.  More completely:
SEVERE: Exception
java.lang.IllegalStateException: Mouse must be created.
   at org.lwjgl.input.Cursor.getMaxCursorSize(Cursor.java:137)
   at org.fenggui.render.lwjgl.LWJGLCursorFactory.<init>(Unknown Source)
   at org.fenggui.render.lwjgl.LWJGLBinding.<init>(Unknown Source)
   at org.fenggui.render.lwjgl.LWJGLBinding.<init>(Unknown Source)
   at myjme.Demo.FengGUIGameState.buildUI(FengGUIGameState.java:56)
   at myjme.Demo.FengGUIGameState.<init>(FengGUIGameState.java:48)
   at myjme.Demo.StationAlphaMain.simpleAppletSetup(StationAlphaMain.java:180)
   at myjme.Demo.DEBaseApplet$SimpleAppletCanvasImplementor.simpleSetup(DEBaseApplet.java:383)
   at com.jmex.awt.SimpleCanvasImpl.doSetup(Unknown Source)
   at com.jmex.awt.lwjgl.LWJGLCanvas.paintGL(Unknown Source)
   at org.lwjgl.opengl.AWTGLCanvas.paint(AWTGLCanvas.java:308)
   at org.lwjgl.opengl.AWTGLCanvas.update(AWTGLCanvas.java:339)
   at sun.awt.RepaintArea.updateComponent(Unknown Source)
   at sun.awt.RepaintArea.paint(Unknown Source)
   at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
   at java.awt.Component.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)


I tried the obvious call Mouse.create() before trying to create the display.
This throws an exception complaining about no display.

Any thoughts on how to solve this?

Thanks in advance.
Title: Re: IllegalStateException: Mouse must be created.
Post by: emanon on March 25, 2008, 00:59:38
I'm not there yet, but after much head spinning from similarly named classes I can contribute something that hopefully someone with more engine familiarity can suggest a workaround for.

I'm running inside an APPLET.
As a result of this, an AWTGLCanvas is created rather than a window.
It appears that LWJGL only registers the display system as being built if a window is created.  (lwjgl.Display.isCreated()  tests against the var window_created).

Thus, when trying to create the LWJGLBinding, everything fubars (since Display.create has not happened).


Cross posting to jme and fenggui.
Thanks for ideas.

Title: Re: IllegalStateException: Mouse must be created.
Post by: Fool Running on March 25, 2008, 13:36:00
Wrong forum, by the way. But I happen to know the answer to your question ;D:
You need to use the AWTGLCanvasBinding instead of the LWJGLBinding.
Title: Re: IllegalStateException: Mouse must be created.
Post by: emanon on March 26, 2008, 13:39:09
Worked like a charm.

tyvm