summaryrefslogtreecommitdiffstats
path: root/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2005-09-09 07:08:45 +0000
committerKenneth Russel <[email protected]>2005-09-09 07:08:45 +0000
commitffb098e3eed864346f1bd9f53021b17f9148da49 (patch)
treec95f36b4e25fb8facace3e8ead0827e61a80093e /src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java
parent6988570ed0a3ffa8f6d544cdb245cb7f0e77885c (diff)
Refactored demos to mostly subclass common Demo superclass providing
shutdown capabilities. Moved DemoListener to demos.common package. Added ManipManager removal code to demos using manipulators or ExaminerViewer to fix memory leak when run in JRefract harness. Added workaround for another seeming memory leak when run under current JDK 1.6 due to java.awt.Component now being finalizable and keeping data alive longer than previously. Made ManipManager.unregisterWindow more lenient with respect to null or invalid arguments. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JSR-231@122 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
Diffstat (limited to 'src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java')
-rw-r--r--src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java b/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java
index eb90430..05594be 100644
--- a/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java
+++ b/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java
@@ -45,6 +45,7 @@ import javax.imageio.stream.*;
import javax.media.opengl.*;
import com.sun.opengl.utils.*;
import com.sun.opengl.utils.*;
+import demos.common.*;
import demos.util.*;
import gleem.*;
import gleem.linalg.*;
@@ -66,7 +67,7 @@ import gleem.linalg.*;
Ported to Java by Kenneth Russell
*/
-public class InfiniteShadowVolumes implements GLEventListener {
+public class InfiniteShadowVolumes extends Demo {
public static void main(String[] args) {
GLCapabilities caps = new GLCapabilities();
caps.setStencilBits(16);
@@ -98,15 +99,14 @@ public class InfiniteShadowVolumes implements GLEventListener {
});
}
- public void setDemoListener(DemoListener listener) {
- demoListener = listener;
- }
-
//----------------------------------------------------------------------
// Internals only below this point
//
- private DemoListener demoListener;
+ public void shutdownDemo() {
+ ManipManager.getManipManager().unregisterWindow(drawable);
+ super.shutdownDemo();
+ }
static class Model {
Model() {
@@ -148,6 +148,7 @@ public class InfiniteShadowVolumes implements GLEventListener {
private GLUT glut = new GLUT();
+ private GLAutoDrawable drawable;
private ExaminerViewer viewer;
private HandleBoxManip objectManip;
private HandleBoxManip lightManip;
@@ -228,6 +229,7 @@ public class InfiniteShadowVolumes implements GLEventListener {
// Register the window with the ManipManager
ManipManager manager = ManipManager.getManipManager();
manager.registerWindow(drawable);
+ this.drawable = drawable;
objectManip = new HandleBoxManip();
manager.showManipInWindow(objectManip, drawable);
@@ -564,7 +566,7 @@ public class InfiniteShadowVolumes implements GLEventListener {
private void dispatchKey(char k) {
b[k] = ! b[k];
if (k==27 || k=='q') {
- demoListener.shutdownDemo();
+ shutdownDemo();
return;
}