diff options
author | Kenneth Russel <[email protected]> | 2003-07-15 22:32:05 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2003-07-15 22:32:05 +0000 |
commit | e4c41409b1b9e108f80de50a1c2cc9830377c53c (patch) | |
tree | 9a7bc991c9f726c29eb5dca90fb4753b221990e0 /src | |
parent | d1da6a87aa6c6cd5a697b2930a5af4ba0a650faf (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/net/java/games/jogl/Animator.java | 50 |
1 files changed, 27 insertions, 23 deletions
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(); } } } |