Login  Register

Re: key input Keylistener doesn't work for JOGL

Posted by gouessej on Nov 07, 2017; 10:33am
URL: https://forum.jogamp.org/key-input-Keylistener-doesn-t-work-for-JOGL-tp4038300p4038301.html

Hi

If the GLCanvas receives the key events, the key listener will have to be added to it instead of the JFrame, it's a basic Swing problem, it's not a JOGL problem. You could have the same kind of problem in a 2D game using only AWT, you have to put the key listener into the right component.

By the way, replace new GLU() by GLU.createGLU(GL) in order to use a more capable instance of GLU. glFlush is probably useless here.

Good luck.
Julien Gouesse | Personal blog | Website