summaryrefslogtreecommitdiffstats
path: root/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2003-07-15 22:32:06 +0000
committerKenneth Russel <[email protected]>2003-07-15 22:32:06 +0000
commitbeaca5fa8a64e8b7c5e9452fa9828eb9a217bd2e (patch)
treeb9b6ac76a155de85f6b2d2ab0b29686c55ec510d /src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java
parentecb910404a7ba50afa71b3bf18689dc80d8008a5 (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/proceduralTexturePhysics/ProceduralTexturePhysics.java')
-rw-r--r--src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java63
1 files changed, 36 insertions, 27 deletions
diff --git a/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java b/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java
index a27ae05..f34940c 100644
--- a/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java
+++ b/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java
@@ -35,6 +35,7 @@ package demos.proceduralTexturePhysics;
import java.awt.*;
import java.awt.event.*;
+import javax.swing.*;
import net.java.games.jogl.*;
import demos.util.*;
@@ -98,37 +99,43 @@ public class ProceduralTexturePhysics {
}
});
- water = new Water();
- water.initialize("demos/data/images/nvfixed.tga",
- "demos/data/images/nvspin.tga",
- "demos/data/images/droplet.tga",
- "demos/data/cubemaps/CloudyHills_{0}.tga",
- canvas);
-
- while (!quit) {
- if (viewer != null) {
- try {
- if (drawing) {
- canvas.getSize(dim);
- water.addDroplet(new Water.Droplet( 2 * (mousePosX / (float) dim.width - 0.5f),
- -2 * (mousePosY / (float) dim.height - 0.5f),
- 0.08f));
+ try {
+ water = new Water();
+ water.initialize("demos/data/images/nvfixed.tga",
+ "demos/data/images/nvspin.tga",
+ "demos/data/images/droplet.tga",
+ "demos/data/cubemaps/CloudyHills_{0}.tga",
+ canvas);
+ } catch (GLException e) {
+ JOptionPane.showMessageDialog(null, e.toString(), "Unavailable extension", JOptionPane.ERROR_MESSAGE);
+ }
+
+ try {
+ while (!quit) {
+ if (viewer != null) {
+ try {
+ if (drawing) {
+ canvas.getSize(dim);
+ water.addDroplet(new Water.Droplet( 2 * (mousePosX / (float) dim.width - 0.5f),
+ -2 * (mousePosY / (float) dim.height - 0.5f),
+ 0.08f));
+ }
+ water.tick();
+ canvas.display();
+ } catch (GLException e) {
+ // Have seen spurious exceptions getting thrown during SwapBuffers.
+ // Not sure why at this time; disabling of repaint() should prevent
+ // AWT thread from getting involved. Continue animating anyway.
+ e.printStackTrace();
}
- water.tick();
+ } else {
+ // Make the pbuffer get created
canvas.display();
- } catch (GLException e) {
- // Have seen spurious exceptions getting thrown during SwapBuffers.
- // Not sure why at this time; disabling of repaint() should prevent
- // AWT thread from getting involved. Continue animating anyway.
- e.printStackTrace();
}
- } else {
- // Make the pbuffer get created
- canvas.display();
}
+ } finally {
+ System.exit(0);
}
-
- System.exit(0);
}
//----------------------------------------------------------------------
@@ -263,7 +270,9 @@ public class ProceduralTexturePhysics {
private void checkExtension(GL gl, String extensionName) {
if (!gl.isExtensionAvailable(extensionName)) {
- throw new GLException("Unable to initialize " + extensionName + " OpenGL extension");
+ String message = "Unable to initialize " + extensionName + " OpenGL extension";
+ JOptionPane.showMessageDialog(null, message, "Unavailable extension", JOptionPane.ERROR_MESSAGE);
+ throw new GLException(message);
}
}