From 69460f7b1f8d50b4f0f8fedaf25f23f91869f5e9 Mon Sep 17 00:00:00 2001 From: codeanticode Date: Tue, 20 Nov 2012 16:36:23 +0000 Subject: [PATCH] start NEWT's animator at the end, otherwise it might call display() before all the variables are set --- core/src/processing/opengl/PGL.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/core/src/processing/opengl/PGL.java b/core/src/processing/opengl/PGL.java index 032e60d1b..47179c478 100644 --- a/core/src/processing/opengl/PGL.java +++ b/core/src/processing/opengl/PGL.java @@ -571,11 +571,12 @@ public class PGL { pg.parent.removeListeners(pg.parent); pg.parent.addListeners(canvasAWT); - listener = new PGLListener(); - canvasAWT.addGLEventListener(listener); capabilities = canvasAWT.getChosenGLCapabilities(); canvas = canvasAWT; canvasNEWT = null; + + listener = new PGLListener(); + canvasAWT.addGLEventListener(listener); } else if (toolkit == NEWT) { window = GLWindow.create(caps); canvasNEWT = new NewtCanvasAWT(window); @@ -584,26 +585,20 @@ public class PGL { pg.parent.setLayout(new BorderLayout()); pg.parent.add(canvasNEWT, BorderLayout.CENTER); - //pg.parent.removeListeners(pg.parent); - //pg.parent.addListeners(canvasNEWT); com.jogamp.newt.event.MouseListener mouseListener = new NEWTMouseAdapter(); window.addMouseListener(mouseListener); com.jogamp.newt.event.KeyListener keyListener = new NEWTKeyAdapter(); window.addKeyListener(keyListener); - + capabilities = window.getChosenGLCapabilities(); + canvas = canvasNEWT; + canvasAWT = null; listener = new PGLListener(); window.addGLEventListener(listener); animator = new NEWTAnimator(window); animator.start(); - - capabilities = window.getChosenGLCapabilities(); - canvas = canvasNEWT; - canvasAWT = null; - -// System.out.println(capabilities); } initialized = true;