Well, you can't render Swing or AWT components on top of a native OpenGL output. You can try to use FrameBuffer.enableGLCanvasRenderer() (don't forget to disable the software renderer in addition), which will return a Canvas. This (heavyweight) Canvas can be combined with Swing/AWT components to a degree. You should find some information about this when searching the forums.
well,as you say ,I get a AWTGLCanvas which i can put this canvas into a JFrame,but the KeyMapper is wrong, i implements a KeyListener(java.awt.event.KeyListener;),but it seemes not work
my code such as
public class Test implements KeyListener {
frame = new JFrame("test");
panel = new JPanel();
frame.setLayout(new GridLayout(1,1));
frame.setSize(width, height);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(panel);
frame.setVisible(true);
buffer = new FrameBuffer(panel.getWidth(),panel.getHeight(),FrameBuffer.SAMPLINGMODE_HARDWARE_ONLY);
buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
//buffer.enableRenderer(IRenderer.RENDERER_OPENGL, IRenderer.MODE_OPENGL);
canvas = buffer.enableGLCanvasRenderer();
panel.add(canvas,new GridLayout(1,1));
canvas.addKeyListener(this);
frame.addKeyListener(this);
}
public void keyTyped(KeyEvent e){
System.out.println("ley d");
}
public void keyPressed(KeyEvent e){
System.out.println("ley d");
}
public void keyReleased(KeyEvent e){
System.out.println("ley d");
}
the game loop is
buffer.clear();
theWorld.renderScene(buffer);
theWorld.draw(buffer);
buffer.update();
buffer.displayGLOnly();
canvas.repaint();
Is there something I can change to allow the mapper to be correctly ?