From f21921ffbee502483b87b0f7eb03c0af299cb24b Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 10 Oct 2009 07:22:31 -0700 Subject: JOGL changes .. --- src/demos/applets/JOGLNewtApplet1Run.java | 6 +----- src/demos/applets/JOGLNewtAppletBase.java | 15 ++++++++------- 2 files changed, 9 insertions(+), 12 deletions(-) (limited to 'src/demos/applets') diff --git a/src/demos/applets/JOGLNewtApplet1Run.java b/src/demos/applets/JOGLNewtApplet1Run.java index 2d8cd3c..f839387 100755 --- a/src/demos/applets/JOGLNewtApplet1Run.java +++ b/src/demos/applets/JOGLNewtApplet1Run.java @@ -26,8 +26,6 @@ public class JOGLNewtApplet1Run extends Applet { String glEventListenerClazzName=null; String glProfileName=null; int glSwapInterval=0; - boolean handleWindowEvents=true; - boolean useGLInEventHandler=false; boolean glDebug=false; boolean glTrace=false; String tmp; @@ -35,7 +33,6 @@ public class JOGLNewtApplet1Run extends Applet { glEventListenerClazzName = getParameter("gl_event_listener_class"); glProfileName = getParameter("gl_profile"); glSwapInterval = JOGLNewtAppletBase.str2Int(getParameter("gl_swap_interval"), glSwapInterval); - useGLInEventHandler = JOGLNewtAppletBase.str2Bool(getParameter("gl_use_in_events"), useGLInEventHandler); glDebug = JOGLNewtAppletBase.str2Bool(getParameter("gl_debug"), glDebug); glTrace = JOGLNewtAppletBase.str2Bool(getParameter("gl_trace"), glTrace); } catch (Exception e) { @@ -46,8 +43,7 @@ public class JOGLNewtApplet1Run extends Applet { } base = new JOGLNewtAppletBase(glEventListenerClazzName, glSwapInterval, - handleWindowEvents, - useGLInEventHandler, + false /* pumpMessages == handleWindowEvents */, glDebug, glTrace); diff --git a/src/demos/applets/JOGLNewtAppletBase.java b/src/demos/applets/JOGLNewtAppletBase.java index 54dcf8f..12d2af7 100755 --- a/src/demos/applets/JOGLNewtAppletBase.java +++ b/src/demos/applets/JOGLNewtAppletBase.java @@ -16,7 +16,6 @@ public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseLis String glEventListenerClazzName; int glSwapInterval; boolean handleWindowEvents; - boolean useGLInEventHandler; boolean glDebug; boolean glTrace; @@ -28,14 +27,12 @@ public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseLis public JOGLNewtAppletBase(String glEventListenerClazzName, int glSwapInterval, boolean handleWindowEvents, - boolean useGLInEventHandler, boolean glDebug, boolean glTrace) { this.glEventListenerClazzName=glEventListenerClazzName; this.glSwapInterval=glSwapInterval; this.handleWindowEvents=handleWindowEvents; - this.useGLInEventHandler=useGLInEventHandler; this.glDebug = glDebug; this.glTrace = glTrace; } @@ -98,6 +95,10 @@ public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseLis } public void init(Window nWindow) { + init(Thread.currentThread().getThreadGroup(), nWindow); + } + + public void init(ThreadGroup tg, Window nWindow) { glEventListener = createInstance(glEventListenerClazzName); try { @@ -125,13 +126,11 @@ public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseLis } glWindow.addKeyListener(this); - glWindow.setEventHandlerMode( useGLInEventHandler ? GLWindow.EVENT_HANDLER_GL_CURRENT : GLWindow.EVENT_HANDLER_GL_NONE ); glWindow.setRunPumpMessages(handleWindowEvents); - glWindow.setVisible(true); glWindow.enablePerfLog(true); // glAnimator = new FPSAnimator(canvas, 60); - glAnimator = new Animator(glWindow); + glAnimator = new Animator(tg, glWindow); } catch (Throwable t) { throw new RuntimeException(t); } @@ -140,6 +139,7 @@ public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseLis public void start() { if(isValid) { + glWindow.setVisible(true); glAnimator.start(); } } @@ -147,6 +147,7 @@ public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseLis public void stop() { if(null!=glAnimator) { glAnimator.stop(); + glWindow.setVisible(false); } } @@ -158,7 +159,7 @@ public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseLis glAnimator=null; } if(null!=glWindow) { - glWindow.destroy(); + glWindow.destroy(true); // deep, incl. Screen and Display glWindow=null; } } -- cgit v1.2.3