Login  Register

Odd behaviour from GLEventListener with JOGL 2

Posted by Ric Wright on Oct 27, 2010; 7:14pm
URL: https://forum.jogamp.org/Odd-behaviour-from-GLEventListener-with-JOGL-2-tp1782146.html

I recently began experimenting with JOGL 2. I do most of my Java work in Eclipse. One odd behaviour with JOGL2 is that if I create a very simple AWT view with a class that implements GLEventListener, the listener does not get called unless I effectively prime the pump by turning on an Animator (either Animator or FPSAnimator). After a few dozen calls of "display()" the window is initialized and it all works OK. But without this Animator, the init method on the GLEventListener never gets called. Code is very simple - see below. This worked without problems with JOGL 1.1.1. Am I missing something? TIA, Ric public class SimpleSceneAWT implements GLEventListener { public static void main(String[] args) { GLProfile.initSingleton(); GLProfile glp = GLProfile.getDefault(); GLCapabilities caps = new GLCapabilities(glp); GLCanvas canvas = new GLCanvas(caps); Frame frame = new Frame("AWT Window Test"); frame.setSize(300, 300); frame.add(canvas); frame.setVisible(true); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); canvas.addGLEventListener(new SimpleSceneAWT()); /* without this, in JOGL2 the init method never gets called FPSAnimator animator = new FPSAnimator(canvas, 60); animator.add(canvas); animator.start(); */ } /* other methods here */ }