From ffb098e3eed864346f1bd9f53021b17f9148da49 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Fri, 9 Sep 2005 07:08:45 +0000 Subject: 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 --- src/demos/vertexBufferObject/VertexBufferObject.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/demos/vertexBufferObject/VertexBufferObject.java') diff --git a/src/demos/vertexBufferObject/VertexBufferObject.java b/src/demos/vertexBufferObject/VertexBufferObject.java index ee78499..97a5483 100644 --- a/src/demos/vertexBufferObject/VertexBufferObject.java +++ b/src/demos/vertexBufferObject/VertexBufferObject.java @@ -42,6 +42,7 @@ import javax.swing.*; import javax.media.opengl.*; import com.sun.opengl.utils.*; import com.sun.opengl.utils.*; +import demos.common.*; import demos.util.*; /**

A port of NVidia's [tm] Vertex Array Range demonstration to @@ -67,7 +68,7 @@ import demos.util.*; same data in system memory allows.

*/ -public class VertexBufferObject implements GLEventListener { +public class VertexBufferObject extends Demo { public static void main(String[] args) { boolean vboEnabled = true; @@ -124,15 +125,10 @@ public class VertexBufferObject implements GLEventListener { setFlag('i', true); // infinite viewer and light } - public void setDemoListener(DemoListener listener) { - demoListener = listener; - } - //---------------------------------------------------------------------- // Internals only below this point // - private DemoListener demoListener; private boolean initComplete; private boolean[] b = new boolean[256]; private static final int SIZEOF_FLOAT = 4; @@ -266,7 +262,7 @@ public class VertexBufferObject implements GLEventListener { new Thread(new Runnable() { public void run() { JOptionPane.showMessageDialog(null, message, "Unavailable extension", JOptionPane.ERROR_MESSAGE); - demoListener.shutdownDemo(); + shutdownDemo(); } }).start(); throw new RuntimeException(message); @@ -366,7 +362,7 @@ public class VertexBufferObject implements GLEventListener { setFlag(k, !getFlag(k)); // Quit on escape or 'q' if ((k == (char) 27) || (k == 'q')) { - demoListener.shutdownDemo(); + shutdownDemo(); return; } -- cgit v1.2.3