From beaca5fa8a64e8b7c5e9452fa9828eb9a217bd2e Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Tue, 15 Jul 2003 22:32:06 +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-demos/trunk@12 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4 --- .../hwShadowmapsSimple/HWShadowmapsSimple.java | 55 ++++++++++++---------- 1 file changed, 30 insertions(+), 25 deletions(-) (limited to 'src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java') diff --git a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java index 5eb5614..e917ca2 100644 --- a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java +++ b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java @@ -40,6 +40,7 @@ import java.io.*; import java.nio.*; import java.util.*; import javax.imageio.*; +import javax.swing.*; import net.java.games.jogl.*; import net.java.games.jogl.util.*; @@ -158,34 +159,36 @@ public class HWShadowmapsSimple { } }); - while (!quit) { - if (viewer != null) { - viewer.update(); - - // Grab these values once per render to avoid multithreading - // issues with their values being changed by manipulation from - // the AWT thread during the render - CameraParameters params = viewer.getCameraParameters(); - - cameraPerspective.set(params.getProjectionMatrix()); - cameraInverseTransform.set(params.getModelviewMatrix()); - cameraTransform.set(cameraInverseTransform); - cameraTransform.invertRigid(); - spotlightTransform.set(spotlight.getTransform()); - spotlightInverseTransform.set(spotlightTransform); - spotlightInverseTransform.invertRigid(); - objectTransform.set(object.getTransform()); - } + try { + while (!quit) { + if (viewer != null) { + viewer.update(); + + // Grab these values once per render to avoid multithreading + // issues with their values being changed by manipulation from + // the AWT thread during the render + CameraParameters params = viewer.getCameraParameters(); + + cameraPerspective.set(params.getProjectionMatrix()); + cameraInverseTransform.set(params.getModelviewMatrix()); + cameraTransform.set(cameraInverseTransform); + cameraTransform.invertRigid(); + spotlightTransform.set(spotlight.getTransform()); + spotlightInverseTransform.set(spotlightTransform); + spotlightInverseTransform.invertRigid(); + objectTransform.set(object.getTransform()); + } - if (displayMode == RENDER_SCENE_FROM_CAMERA_VIEW_SHADOWED || !fullyInitialized) { - if (pbuffer != null) { - pbuffer.display(); + if (displayMode == RENDER_SCENE_FROM_CAMERA_VIEW_SHADOWED || !fullyInitialized) { + if (pbuffer != null) { + pbuffer.display(); + } } + canvas.display(); } - canvas.display(); + } finally { + System.exit(0); } - - System.exit(0); } //---------------------------------------------------------------------- @@ -372,7 +375,9 @@ public class HWShadowmapsSimple { 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); } } -- cgit v1.2.3