From e4c41409b1b9e108f80de50a1c2cc9830377c53c Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Tue, 15 Jul 2003 22:32:05 +0000 Subject: Fixed bug in Animator where it would hang upon stopping if exception was thrown during init(). Fixed build.xml files to get javac to produce source file and line number information. Fixed demos to pop up a dialog box if an extension they need is unsupported. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@35 232f8b59-042b-4e1e-8c03-345bb8c30851 --- make/build-gluegen.xml | 4 +-- make/build-staticglgen.xml | 4 +-- make/build.xml | 4 +-- src/net/java/games/jogl/Animator.java | 50 +++++++++++++++++++---------------- 4 files changed, 33 insertions(+), 29 deletions(-) diff --git a/make/build-gluegen.xml b/make/build-gluegen.xml index f0236811b..a12f668ab 100644 --- a/make/build-gluegen.xml +++ b/make/build-gluegen.xml @@ -75,7 +75,7 @@ - NOTE: GlueGenTask is NOT built at this time. It is done in - a separate task. --> + source="1.4" debug="true" debuglevel="source,lines"> @@ -135,7 +135,7 @@ - + diff --git a/make/build-staticglgen.xml b/make/build-staticglgen.xml index d054abbb0..0f72bcfa7 100644 --- a/make/build-staticglgen.xml +++ b/make/build-staticglgen.xml @@ -29,7 +29,7 @@ - + @@ -49,7 +49,7 @@ - + diff --git a/make/build.xml b/make/build.xml index 37ab9dbec..0118fbbb5 100644 --- a/make/build.xml +++ b/make/build.xml @@ -678,7 +678,7 @@ - + @@ -694,7 +694,7 @@ + excludes="${java.excludes.platform}" source="1.4" debug="true" debuglevel="source,lines"> diff --git a/src/net/java/games/jogl/Animator.java b/src/net/java/games/jogl/Animator.java index d21d483e1..5ab2aad75 100644 --- a/src/net/java/games/jogl/Animator.java +++ b/src/net/java/games/jogl/Animator.java @@ -80,25 +80,25 @@ public class Animator { if (runnable == null) { runnable = new Runnable() { public void run() { - // Try to get OpenGL context optimization since we know we - // will be rendering this one drawable continually from - // this thread; make the context current once instead of - // making it current and freeing it each frame. - drawable.setRenderingThread(Thread.currentThread()); - - // Since setRenderingThread is currently advisory (because - // of the poor JAWT implementation in the Motif AWT, which - // performs excessive locking) we also prevent repaint(), - // which is called from the AWT thread, from having an - // effect for better multithreading behavior. This call is - // not strictly necessary, but if end users write their - // own animation loops which update multiple drawables per - // tick then it may be necessary to enforce the order of - // updates. - drawable.setNoAutoRedrawMode(true); - boolean noException = false; try { + // Try to get OpenGL context optimization since we know we + // will be rendering this one drawable continually from + // this thread; make the context current once instead of + // making it current and freeing it each frame. + drawable.setRenderingThread(Thread.currentThread()); + + // Since setRenderingThread is currently advisory (because + // of the poor JAWT implementation in the Motif AWT, which + // performs excessive locking) we also prevent repaint(), + // which is called from the AWT thread, from having an + // effect for better multithreading behavior. This call is + // not strictly necessary, but if end users write their + // own animation loops which update multiple drawables per + // tick then it may be necessary to enforce the order of + // updates. + drawable.setNoAutoRedrawMode(true); + while (!shouldStop) { noException = false; drawable.display(); @@ -107,14 +107,18 @@ public class Animator { } finally { shouldStop = false; drawable.setNoAutoRedrawMode(false); - if (noException) { - try { + try { + // The surface is already unlocked and rendering + // thread is already null if an exception occurred + // during display(), so don't disable the rendering + // thread again. + if (noException) { drawable.setRenderingThread(null); - } finally { + } + } finally { + synchronized (Animator.this) { thread = null; - synchronized (Animator.this) { - Animator.this.notify(); - } + Animator.this.notify(); } } } -- cgit v1.2.3