Mouse and Keyboard input for AWTGLCanvas

Started by CodeBunny, March 29, 2011, 16:51:45

Previous topic - Next topic

CodeBunny

How should I handle Mouse and Keyboard input when I've got an AWTGLCanvas running inside of a JFrame along with other components?

I get this error:

Mouse must be created before you can read events
	at org.lwjgl.input.Mouse.next(Mouse.java:423)

kappa

don't think you can use LWJGL Mouse and Keyboard classes when using an AWTGLCanvas as they require lwjgl's native window to function (and in this case it doesn't exist). Instead you will have to use AWT's input classes.

If however you use want to embed with AWT and still use LWJGL Mouse and Keyboard classes you will have to use the Display.setParent(Canvas) method.

CodeBunny

Ah, I see. Yeah, I can't use Display.setParent(); I've got multiple AWTGLCanvases at once.