diff options
author | Kenneth Russel <[email protected]> | 2003-07-15 22:32:06 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2003-07-15 22:32:06 +0000 |
commit | beaca5fa8a64e8b7c5e9452fa9828eb9a217bd2e (patch) | |
tree | b9b6ac76a155de85f6b2d2ab0b29686c55ec510d /src/demos/vertexArrayRange | |
parent | ecb910404a7ba50afa71b3bf18689dc80d8008a5 (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-demos/trunk@12 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
Diffstat (limited to 'src/demos/vertexArrayRange')
-rw-r--r-- | src/demos/vertexArrayRange/VertexArrayRange.java | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/src/demos/vertexArrayRange/VertexArrayRange.java b/src/demos/vertexArrayRange/VertexArrayRange.java index 18bf196..825c668 100644 --- a/src/demos/vertexArrayRange/VertexArrayRange.java +++ b/src/demos/vertexArrayRange/VertexArrayRange.java @@ -37,6 +37,7 @@ import java.awt.*; import java.awt.event.*; import java.nio.*; import java.util.*; +import javax.swing.*; import net.java.games.jogl.*; @@ -257,7 +258,14 @@ public class VertexArrayRange { private void ensurePresent(String function) { if (!canvas.getGL().isFunctionAvailable(function)) { - throw new RuntimeException("OpenGL routine \"" + function + "\" not available"); + final String message = "OpenGL routine \"" + function + "\" not available"; + new Thread(new Runnable() { + public void run() { + JOptionPane.showMessageDialog(null, message, "Unavailable extension", JOptionPane.ERROR_MESSAGE); + runExit(); + } + }).start(); + throw new RuntimeException(message); } } @@ -285,7 +293,7 @@ public class VertexArrayRange { ensurePresent("glFinishFenceNV"); ensurePresent("glAllocateMemoryNV"); } catch (RuntimeException e) { - runExit(); + quit = true; throw (e); } @@ -647,22 +655,6 @@ public class VertexArrayRange { // Unused routines public void displayChanged(GLDrawable drawable, boolean modeChanged, boolean deviceChanged) {} - - private void runExit() { - quit = true; - // Note: calling System.exit() synchronously inside the draw, - // reshape or init callbacks can lead to deadlocks on certain - // platforms (in particular, X11) because the JAWT's locking - // routines cause a global AWT lock to be grabbed. Run the - // exit routine in another thread and cause this one to - // terminate by throwing an exception out of it. - new Thread(new Runnable() { - public void run() { - animator.stop(); - System.exit(0); - } - }).start(); - } } // end class VARListener private void allocateBigArray(GL gl, boolean tryAgain) { @@ -726,4 +718,20 @@ public class VertexArrayRange { } } } + + private void runExit() { + quit = true; + // Note: calling System.exit() synchronously inside the draw, + // reshape or init callbacks can lead to deadlocks on certain + // platforms (in particular, X11) because the JAWT's locking + // routines cause a global AWT lock to be grabbed. Run the + // exit routine in another thread and cause this one to + // terminate by throwing an exception out of it. + new Thread(new Runnable() { + public void run() { + animator.stop(); + System.exit(0); + } + }).start(); + } } |