summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2009-03-14 05:22:19 +0000
committerSven Gothel <[email protected]>2009-03-14 05:22:19 +0000
commitb2c27c8edc2e9516a5341332a3480485d72eb6af (patch)
tree8a4f92d3f9e351471f4f8aef5d8260fb376f4a89
parent8417ded5c1f892b58a4608ff248842c8aed4026a (diff)
NEWT window closing:
- New WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY and WindowListener.windowDestroyNotify() method. - Removed windowClosed() method for JNI hook - Added windowDestroyNotify() windowDestroyed(), where windowDestroyNotify() shall be called by the native implementation _before_ the window gets shutdown. The Window.java then sends a WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY event, and either Window.java or it's owner GLWindow.java issues the destroy() procedure. - Added GLEventListener.dispose(GLAutoDrawable), to allow user application to release GL ressources. Issued by GLWindow (-> see windowDestroyNotify()) - X11 impl intercepts WM_DELETE_WINDOW, using Atom, MacosX impl already uses the _before_ method (VERIFY), and Windows impl uses the WM_CLOSE event (VERIFY). JOGL2 dispose/destroy .. - Added GLEventListener.dispose() to GLCanvas and GLJpanel - GL* toString() rearrangement, assumes it is issued by GLContext(), which indeed is the core information node. - Added proper destroy() methods and calls, to achieve a proper resource release at destruction. Instrumentizing almost all classes with a destroy() method, so no release function lookup is necessary. - misc changes .. JOGL2 Demos - Fixed in regards to the above changes git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JOGL_2_SANDBOX@321 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
-rw-r--r--make/make.jogl.all.x86.sh2
-rw-r--r--make/make.jogl.all.x86_64.sh2
-rwxr-xr-xsrc/demos/GLInfo.java5
-rw-r--r--src/demos/cg/runtime_ogl/cgGL_vertex_example.java3
-rw-r--r--src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java3
-rwxr-xr-xsrc/demos/cubefbo/CubeObject.java19
-rwxr-xr-xsrc/demos/cubefbo/FBCubes.java22
-rwxr-xr-xsrc/demos/cubefbo/FBObject.java125
-rwxr-xr-xsrc/demos/es1/Info.java5
-rwxr-xr-xsrc/demos/es1/RedSquare.java33
-rwxr-xr-xsrc/demos/es1/angeles/AngelesES1.java3
-rwxr-xr-xsrc/demos/es1/angeles/AngelesGL.java3
-rwxr-xr-xsrc/demos/es1/angeles/AngelesGLil.java3
-rwxr-xr-xsrc/demos/es1/angeles/Main.java11
-rw-r--r--src/demos/es1/cube/Cube.java13
-rw-r--r--src/demos/es1/cube/CubeImmModeSink.java10
-rwxr-xr-xsrc/demos/es1/cubefbo/FBCubes.java13
-rwxr-xr-xsrc/demos/es1/cubefbo/Main.java12
-rwxr-xr-xsrc/demos/es2/RedSquare.java12
-rw-r--r--src/demos/es2/openmax/Cube.java10
-rwxr-xr-xsrc/demos/es2/openmax/MovieCube.java14
-rwxr-xr-xsrc/demos/es2/openmax/MovieSimple.java17
-rwxr-xr-xsrc/demos/es2/perftst/Perftst.java13
-rwxr-xr-xsrc/demos/fullscreen/FullscreenWorkaround.java3
-rw-r--r--src/demos/gears/Gears.java4
-rwxr-xr-xsrc/demos/hdr/HDR.java3
-rw-r--r--src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java8
-rw-r--r--src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java16
-rwxr-xr-xsrc/demos/j2d/CustomText.java3
-rwxr-xr-xsrc/demos/j2d/FlyingText.java7
-rwxr-xr-xsrc/demos/j2d/TestOverlay.java7
-rwxr-xr-xsrc/demos/j2d/TestTextRenderer.java6
-rwxr-xr-xsrc/demos/j2d/TestTextureRenderer.java7
-rwxr-xr-xsrc/demos/j2d/TextCube.java3
-rwxr-xr-xsrc/demos/j2d/TextFlow.java5
-rwxr-xr-xsrc/demos/misc/Picking.java3
-rwxr-xr-xsrc/demos/multisample/Multisample.java3
-rwxr-xr-xsrc/demos/nurbs/curveapp/GLListener.java7
-rwxr-xr-xsrc/demos/nurbs/surfaceapp/GLListener.java7
-rwxr-xr-xsrc/demos/particles/engine/GLComponent.java4
-rwxr-xr-xsrc/demos/printext/PrintExt.java3
-rw-r--r--src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java7
-rw-r--r--src/demos/proceduralTexturePhysics/Water.java3
-rw-r--r--src/demos/tess/Tess.java4
-rwxr-xr-xsrc/demos/testContextDestruction/TestContextDestruction.java3
-rw-r--r--src/demos/testContextSharing/TestContextSharing.java3
-rwxr-xr-xsrc/demos/texture/TestSubImage.java3
-rwxr-xr-xsrc/demos/texture/TestTexture.java3
-rw-r--r--src/demos/vertexArrayRange/VertexArrayRange.java3
-rw-r--r--src/demos/vertexBufferObject/VertexBufferObject.java3
-rw-r--r--src/demos/vertexProgRefract/VertexProgRefract.java3
-rw-r--r--src/demos/vertexProgWarp/VertexProgWarp.java3
-rw-r--r--src/gleem/ExaminerViewer.java1
-rw-r--r--src/gleem/TestExaminerViewer.java3
-rw-r--r--src/gleem/TestHandleBox.java3
-rw-r--r--src/gleem/TestMultiWin.java3
-rw-r--r--src/gleem/TestTranslate1.java3
-rw-r--r--src/gleem/TestTranslate2.java3
-rw-r--r--src/jbullet/src/javabullet/demos/opengl/DemoApplication.java4
-rw-r--r--src/jbullet/src/javabullet/demos/opengl/JOGL.java11
60 files changed, 365 insertions, 156 deletions
diff --git a/make/make.jogl.all.x86.sh b/make/make.jogl.all.x86.sh
index 5d836f6..89745c9 100644
--- a/make/make.jogl.all.x86.sh
+++ b/make/make.jogl.all.x86.sh
@@ -4,6 +4,6 @@
# -Dc.compiler.debug=true
-ant -v \
+ant \
-Drootrel.build=build-x86 \
$* 2>&1 | tee make.jogl.all.x86.log
diff --git a/make/make.jogl.all.x86_64.sh b/make/make.jogl.all.x86_64.sh
index c4c7d08..6d96b9c 100644
--- a/make/make.jogl.all.x86_64.sh
+++ b/make/make.jogl.all.x86_64.sh
@@ -4,6 +4,6 @@
# -Dc.compiler.debug=true
-ant -v \
+ant \
-Drootrel.build=build-x86_64 \
$* 2>&1 | tee make.jogl.all.x86_64.log
diff --git a/src/demos/GLInfo.java b/src/demos/GLInfo.java
index 70fcb91..be4732e 100755
--- a/src/demos/GLInfo.java
+++ b/src/demos/GLInfo.java
@@ -45,7 +45,7 @@ public class GLInfo implements GLEventListener {
window.display();
// Shut things down cooperatively
- window.close();
+ window.destroy();
window.getFactory().shutdown();
System.out.println("GLInfo shut down cleanly.");
} catch (Throwable t) {
@@ -78,6 +78,9 @@ public class GLInfo implements GLEventListener {
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
}
diff --git a/src/demos/cg/runtime_ogl/cgGL_vertex_example.java b/src/demos/cg/runtime_ogl/cgGL_vertex_example.java
index d35bd6f..aded2d2 100644
--- a/src/demos/cg/runtime_ogl/cgGL_vertex_example.java
+++ b/src/demos/cg/runtime_ogl/cgGL_vertex_example.java
@@ -156,6 +156,9 @@ public class cgGL_vertex_example implements GLEventListener
CgGL.cgGLDisableProfile(profile);
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable)
{
GL gl = drawable.getGL();
diff --git a/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java b/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java
index 1239bf9..50cae18 100644
--- a/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java
+++ b/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java
@@ -115,6 +115,9 @@ public class runtime_ogl_vertex_fragment implements GLEventListener
gl.glEnable(GL.GL_DEPTH_TEST);
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
private void CheckCgError()
{
/*CGerror*/ int err = CgGL.cgGetError();
diff --git a/src/demos/cubefbo/CubeObject.java b/src/demos/cubefbo/CubeObject.java
index e192554..0940902 100755
--- a/src/demos/cubefbo/CubeObject.java
+++ b/src/demos/cubefbo/CubeObject.java
@@ -86,6 +86,25 @@ class CubeObject {
static final float[] material_spec = { 1.0f, 1.0f, 1.0f, 0.f };
static final float[] zero_vec4 = { 0.0f, 0.0f, 0.0f, 0.f };
+ public void dispose(GL2 gl) {
+ gl.glDisableClientState(GL2ES1.GL_VERTEX_ARRAY);
+ gl.glDisableClientState(GL2ES1.GL_NORMAL_ARRAY);
+ gl.glDisableClientState(GL2ES1.GL_COLOR_ARRAY);
+ gl.glDisableClientState(GL2ES1.GL_TEXTURE_COORD_ARRAY);
+ this.cubeVertices.clear();
+ this.cubeVertices=null;
+ this.cubeColors.clear();
+ this.cubeColors=null;
+ this.cubeNormals.clear();
+ this.cubeNormals=null;
+ this.cubeIndices.clear();
+ this.cubeIndices=null;
+ if(null!=this.cubeTexCoords) {
+ this.cubeTexCoords.clear();
+ this.cubeTexCoords=null;
+ }
+ }
+
public void reshape(GL2 gl, int x, int y, int width, int height) {
float aspect = (height != 0) ? ((float)width / (float)height) : 1.0f;
diff --git a/src/demos/cubefbo/FBCubes.java b/src/demos/cubefbo/FBCubes.java
index 78233e2..50bd502 100755
--- a/src/demos/cubefbo/FBCubes.java
+++ b/src/demos/cubefbo/FBCubes.java
@@ -43,6 +43,7 @@ import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.awt.GLCanvas;
+import javax.media.opengl.util.FBObject;
@@ -54,13 +55,14 @@ class FBCubes implements GLEventListener, MouseListener, MouseMotionListener {
cubeInner = new CubeObject(false);
cubeMiddle = new CubeObject(true);
cubeOuter = new CubeObject(true);
- fbo1 = new FBObject(FBO_SIZE, FBO_SIZE);
- fbo2 = new FBObject(FBO_SIZE, FBO_SIZE);
+ fbo1 = new FBObject(FBO_SIZE, FBO_SIZE, 0);
+ fbo2 = new FBObject(FBO_SIZE, FBO_SIZE, 0);
}
public void init(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
- drawable.setGL(new DebugGL2(gl));
+ // drawable.setGL(new DebugGL2(gl));
+ // gl = drawable.getGL().getGL2();
fbo1.init(gl);
fbo2.init(gl);
}
@@ -78,6 +80,20 @@ class FBCubes implements GLEventListener, MouseListener, MouseMotionListener {
motionIncr = 180.f / Math.max(width, height);
}
+ public void dispose(GLAutoDrawable drawable) {
+ System.out.println("FBCubes.dispose: "+drawable);
+ GL2 gl = drawable.getGL().getGL2();
+ fbo1.destroy(gl);
+ fbo2.destroy(gl);
+ fbo1=null; fbo2=null;
+ cubeInner.dispose(gl);
+ cubeInner=null;
+ cubeMiddle.dispose(gl);
+ cubeMiddle=null;
+ cubeOuter.dispose(gl);
+ cubeOuter=null;
+ }
+
public void display(GLAutoDrawable drawable) {
// System.out.println("display");
GL2 gl = drawable.getGL().getGL2();
diff --git a/src/demos/cubefbo/FBObject.java b/src/demos/cubefbo/FBObject.java
deleted file mode 100755
index 0873888..0000000
--- a/src/demos/cubefbo/FBObject.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistribution of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistribution in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- */
-
-package demos.cubefbo;
-
-import javax.media.opengl.GL2ES1;
-import javax.media.opengl.GL2;
-
-
-class FBObject {
- private int fb, fbo_tex, depth_rb, stencil_rb, width, height;
-
- public FBObject(int width, int height) {
-
- this.width = width;
- this.height = height;
- }
-
- public void init(GL2 gl) {
- // generate fbo ..
- int name[] = new int[1];
-
- gl.glGenTextures(1, name, 0);
- fbo_tex = name[0];
- System.out.println("fbo_tex: "+fbo_tex);
-
- gl.glBindTexture(GL2.GL_TEXTURE_2D, fbo_tex);
- gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_NEAREST);
- gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_NEAREST);
- gl.glTexImage2D(GL2.GL_TEXTURE_2D, 0, GL2.GL_RGB8, width, height, 0,
- GL2.GL_RGB, GL2.GL_UNSIGNED_BYTE, null);
-
- gl.glGenRenderbuffers(1, name, 0);
- depth_rb = name[0];
- System.out.println("depth_rb: "+depth_rb);
-
- // Initialize the depth buffer:
- gl.glBindRenderbuffer(GL2.GL_RENDERBUFFER, depth_rb);
- gl.glRenderbufferStorage(GL2.GL_RENDERBUFFER,
- GL2.GL_DEPTH_COMPONENT24, width, height);
-
- // gl.glGenRenderbuffersEXT(1, name, 0);
- // stencil_rb = name[0];
- stencil_rb = 0;
- System.out.println("stencil_rb: "+stencil_rb);
-
- gl.glGenFramebuffers(1, name, 0);
- fb = name[0];
- System.out.println("fb: "+fb);
-
- // bind fbo ..
- gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, fb);
-
- // Set up the color buffer for use as a renderable texture:
- gl.glFramebufferTexture2D(GL2.GL_FRAMEBUFFER,
- GL2.GL_COLOR_ATTACHMENT0,
- GL2.GL_TEXTURE_2D, fbo_tex, 0);
-
- // Set up the depth buffer attachment:
- gl.glFramebufferRenderbuffer(GL2.GL_FRAMEBUFFER,
- GL2.GL_DEPTH_ATTACHMENT,
- GL2.GL_RENDERBUFFER, depth_rb);
-
- if(stencil_rb!=0) {
- // Initialize the stencil buffer:
- gl.glBindRenderbuffer(GL2.GL_RENDERBUFFER, stencil_rb);
-
- gl.glRenderbufferStorage(GL2.GL_RENDERBUFFER,
- GL2.GL_STENCIL_INDEX8, width, height);
-
- gl.glFramebufferRenderbuffer(GL2.GL_FRAMEBUFFER,
- GL2.GL_STENCIL_ATTACHMENT,
- GL2.GL_RENDERBUFFER, stencil_rb);
- }
- unbind(gl);
- }
-
- public void bind(GL2 gl) {
- gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, fb);
- }
-
- public void unbind(GL2 gl) {
- // gl.glBindTexture(GL2.GL_TEXTURE_2D, 0);
- // gl.glDisable (GL2.GL_TEXTURE_2D);
- gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, 0);
- }
-
- public int getFBName() {
- return fb;
- }
- public int getTextureName() {
- return fbo_tex;
- }
-}
-
diff --git a/src/demos/es1/Info.java b/src/demos/es1/Info.java
index 4c7d667..8a3c061 100755
--- a/src/demos/es1/Info.java
+++ b/src/demos/es1/Info.java
@@ -43,7 +43,7 @@ public class Info implements GLEventListener {
window.display();
// Shut things down cooperatively
- window.close();
+ window.destroy();
window.getFactory().shutdown();
System.out.println("Info shut down cleanly.");
} catch (Throwable t) {
@@ -63,6 +63,9 @@ public class Info implements GLEventListener {
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
}
diff --git a/src/demos/es1/RedSquare.java b/src/demos/es1/RedSquare.java
index 56a367a..7865f15 100755
--- a/src/demos/es1/RedSquare.java
+++ b/src/demos/es1/RedSquare.java
@@ -11,12 +11,22 @@ import com.sun.opengl.impl.fixed.GLFixedFuncImpl;
import com.sun.javafx.newt.*;
-public class RedSquare implements KeyListener, MouseListener, GLEventListener {
+public class RedSquare implements WindowListener, KeyListener, MouseListener, GLEventListener {
private GLWindow window;
private GLU glu;
private boolean quit = false;
+ public void windowResized(WindowEvent e) {
+ }
+
+ public void windowMoved(WindowEvent e) {
+ }
+
+ public void windowDestroyNotify(WindowEvent e) {
+ quit=true;
+ }
+
public void keyPressed(KeyEvent e) {
System.out.println(e);
}
@@ -72,6 +82,7 @@ public class RedSquare implements KeyListener, MouseListener, GLEventListener {
}
window = GLWindow.create(nWindow, caps);
+ window.addWindowListener(this);
window.addMouseListener(this);
window.addKeyListener(this);
window.addGLEventListener(this);
@@ -84,12 +95,12 @@ public class RedSquare implements KeyListener, MouseListener, GLEventListener {
// window.setFullscreen(true);
window.setVisible(true);
- while (!quit && window.getDuration() < 20000) {
+ do {
window.display();
- }
+ } while (!quit && window.getDuration() < 20000) ;
// Shut things down cooperatively
- window.close();
+ window.destroy();
window.getFactory().shutdown();
System.out.println("RedSquare shut down cleanly.");
} catch (Throwable t) {
@@ -182,6 +193,20 @@ public class RedSquare implements KeyListener, MouseListener, GLEventListener {
gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4);
}
+ public void dispose(GLAutoDrawable drawable) {
+ GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL());
+ System.out.println("Demo.dispose: "+gl.getContext());
+ gl.glDisableClientState(gl.GL_VERTEX_ARRAY);
+ gl.glDisableClientState(gl.GL_COLOR_ARRAY);
+ glu.destroy();
+ glu = null;
+ colors.clear();
+ colors = null;
+ vertices.clear();
+ vertices = null;
+ System.out.println("Demo.dispose: fin");
+ }
+
public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
}
diff --git a/src/demos/es1/angeles/AngelesES1.java b/src/demos/es1/angeles/AngelesES1.java
index 28369e2..a58a198 100755
--- a/src/demos/es1/angeles/AngelesES1.java
+++ b/src/demos/es1/angeles/AngelesES1.java
@@ -136,6 +136,9 @@ public class AngelesES1 implements GLEventListener {
System.out.println("reshape ..");
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
long tick = System.currentTimeMillis();
diff --git a/src/demos/es1/angeles/AngelesGL.java b/src/demos/es1/angeles/AngelesGL.java
index 7df2526..386d1db 100755
--- a/src/demos/es1/angeles/AngelesGL.java
+++ b/src/demos/es1/angeles/AngelesGL.java
@@ -168,6 +168,9 @@ public class AngelesGL implements GLEventListener {
//System.out.println("reshape ..");
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
long tick = System.currentTimeMillis();
diff --git a/src/demos/es1/angeles/AngelesGLil.java b/src/demos/es1/angeles/AngelesGLil.java
index 8e71840..415008e 100755
--- a/src/demos/es1/angeles/AngelesGLil.java
+++ b/src/demos/es1/angeles/AngelesGLil.java
@@ -180,6 +180,9 @@ public class AngelesGLil implements GLEventListener {
//System.out.println("reshape ..");
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
long tick = System.currentTimeMillis();
diff --git a/src/demos/es1/angeles/Main.java b/src/demos/es1/angeles/Main.java
index 4983619..a4e345b 100755
--- a/src/demos/es1/angeles/Main.java
+++ b/src/demos/es1/angeles/Main.java
@@ -5,11 +5,17 @@ import javax.media.nwi.*;
import javax.media.opengl.*;
import com.sun.javafx.newt.*;
-public class Main implements MouseListener {
+public class Main implements WindowListener, MouseListener {
public boolean quit = false;
public GLWindow window = null;
+ public void windowResized(WindowEvent e) { }
+ public void windowMoved(WindowEvent e) { }
+ public void windowDestroyNotify(WindowEvent e) {
+ quit = true;
+ }
+
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() > 1) {
quit=true;
@@ -57,6 +63,7 @@ public class Main implements MouseListener {
}
window = GLWindow.create(nWindow, caps);
+ window.addWindowListener(this);
window.addMouseListener(this);
window.enablePerfLog(true);
@@ -86,7 +93,7 @@ public class Main implements MouseListener {
}
// Shut things down cooperatively
- window.close();
+ window.destroy();
window.getFactory().shutdown();
System.out.println("angeles.Main shut down cleanly.");
} catch (GLException e) {
diff --git a/src/demos/es1/cube/Cube.java b/src/demos/es1/cube/Cube.java
index 1ef6aab..cc2f8e8 100644
--- a/src/demos/es1/cube/Cube.java
+++ b/src/demos/es1/cube/Cube.java
@@ -43,6 +43,8 @@ import com.sun.opengl.impl.fixed.GLFixedFuncImpl;
import com.sun.javafx.newt.*;
public class Cube implements GLEventListener {
+ boolean quit = false;
+
public Cube () {
this(false, false);
}
@@ -170,9 +172,10 @@ public class Cube implements GLEventListener {
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboNames[3]);
gl.glBufferData(GL.GL_ARRAY_BUFFER, cubeTexCoords.limit() * BufferUtil.SIZEOF_SHORT, cubeTexCoords, GL.GL_STATIC_DRAW);
gl.glTexCoordPointer(2, gl.GL_SHORT, 0, 0);
+ /* issues an GL_INVALID_ENUM
if(null!=gl2es1) {
gl2es1.glTexEnvi(gl2es1.GL_TEXTURE_ENV, gl2es1.GL_TEXTURE_ENV_MODE, gl2es1.GL_INCR);
- }
+ } */
} else {
gl.glDisableClientState(gl.GL_TEXTURE_COORD_ARRAY);
}
@@ -193,6 +196,10 @@ public class Cube implements GLEventListener {
// weird effect ..: gl.glCullFace(gl.GL_FRONT);
}
+ public void dispose(GLAutoDrawable drawable) {
+ quit=true;
+ }
+
public void display(GLAutoDrawable drawable) {
GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL());
@@ -333,12 +340,12 @@ public class Cube implements GLEventListener {
window.setFullscreen(true);
window.setVisible(true);
- while (window.getDuration() < 31000) {
+ while (!quit && window.getDuration() < 31000) {
window.display();
}
// Shut things down cooperatively
- window.close();
+ window.destroy();
window.getFactory().shutdown();
System.out.println("Cube shut down cleanly.");
} catch (Throwable t) {
diff --git a/src/demos/es1/cube/CubeImmModeSink.java b/src/demos/es1/cube/CubeImmModeSink.java
index c7536d2..235d376 100644
--- a/src/demos/es1/cube/CubeImmModeSink.java
+++ b/src/demos/es1/cube/CubeImmModeSink.java
@@ -43,6 +43,8 @@ import java.nio.*;
import com.sun.javafx.newt.*;
public class CubeImmModeSink implements GLEventListener {
+ boolean quit = false;
+
public CubeImmModeSink () {
this(false, false);
}
@@ -256,6 +258,10 @@ public class CubeImmModeSink implements GLEventListener {
// weird effect ..: gl.glCullFace(gl.GL_FRONT);
}
+ public void dispose(GLAutoDrawable drawable) {
+ quit=true;
+ }
+
public void display(GLAutoDrawable drawable) {
GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL());
GL2ES1 gl2es1=null;
@@ -425,12 +431,12 @@ public class CubeImmModeSink implements GLEventListener {
long curTime;
long startTime = System.currentTimeMillis();
- while (((curTime = System.currentTimeMillis()) - startTime) < 31000) {
+ while (!quit && ((curTime = System.currentTimeMillis()) - startTime) < 31000) {
window.display();
}
// Shut things down cooperatively
- window.close();
+ window.destroy();
window.getFactory().shutdown();
System.out.println("CubeImmModeSink shut down cleanly.");
} catch (Throwable t) {
diff --git a/src/demos/es1/cubefbo/FBCubes.java b/src/demos/es1/cubefbo/FBCubes.java
index f5f98f1..624bbc2 100755
--- a/src/demos/es1/cubefbo/FBCubes.java
+++ b/src/demos/es1/cubefbo/FBCubes.java
@@ -59,6 +59,8 @@ class FBCubes implements GLEventListener {
GLFixedFuncIf gl;
{
GL _gl = drawable.getGL();
+ // drawable.setGL(new DebugGL2(_gl.getGL2()));
+ // _gl = drawable.getGL();
if(!GLFixedFuncUtil.isGLFixedFuncIf(_gl)) {
if(_gl.isGLES2()) {
gl = new GLFixedFuncImpl(_gl, new FixedFuncHook(_gl.getGL2ES2()));
@@ -70,6 +72,7 @@ class FBCubes implements GLEventListener {
gl = GLFixedFuncUtil.getGLFixedFuncIf(_gl);
}
}
+
System.out.println(gl);
gl.glGetError(); // flush error ..
@@ -110,6 +113,16 @@ class FBCubes implements GLEventListener {
this.yRot = yRot;
}
+ public void dispose(GLAutoDrawable drawable) {
+ GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL());
+ fbo1.destroy(gl);
+ fbo1=null;
+ cubeInner.dispose(drawable);
+ cubeInner=null;
+ cubeOuter.dispose(drawable);
+ cubeOuter=null;
+ }
+
public void display(GLAutoDrawable drawable) {
GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL());
diff --git a/src/demos/es1/cubefbo/Main.java b/src/demos/es1/cubefbo/Main.java
index f245733..9d3df4e 100755
--- a/src/demos/es1/cubefbo/Main.java
+++ b/src/demos/es1/cubefbo/Main.java
@@ -5,12 +5,19 @@ import javax.media.nwi.*;
import javax.media.opengl.*;
import com.sun.javafx.newt.*;
-public class Main implements MouseListener {
+public class Main implements WindowListener, MouseListener {
public boolean quit = false;
public GLWindow window = null;
+ public void windowResized(WindowEvent e) { }
+ public void windowMoved(WindowEvent e) { }
+ public void windowDestroyNotify(WindowEvent e) {
+ quit = true;
+ }
+
public void mouseClicked(MouseEvent e) {
+ System.out.println("mouseevent: "+e);
switch(e.getClickCount()) {
case 1:
if(null!=window) {
@@ -57,6 +64,7 @@ public class Main implements MouseListener {
}
window = GLWindow.create(nWindow, caps);
+ window.addWindowListener(this);
window.addMouseListener(this);
window.enablePerfLog(true);
@@ -73,7 +81,7 @@ public class Main implements MouseListener {
}
// Shut things down cooperatively
- window.close();
+ window.destroy();
window.getFactory().shutdown();
System.out.println("cubefbo.Main shut down cleanly.");
} catch (GLException e) {
diff --git a/src/demos/es2/RedSquare.java b/src/demos/es2/RedSquare.java
index de7563e..b224233 100755
--- a/src/demos/es2/RedSquare.java
+++ b/src/demos/es2/RedSquare.java
@@ -80,7 +80,7 @@ public class RedSquare implements MouseListener, GLEventListener {
}
// Shut things down cooperatively
- window.close();
+ window.destroy();
window.getFactory().shutdown();
System.out.println("RedSquare shut down cleanly.");
} catch (Throwable t) {
@@ -189,6 +189,16 @@ public class RedSquare implements MouseListener, GLEventListener {
st.glUseProgram(gl, false);
}
+ public void dispose(GLAutoDrawable drawable) {
+ GL2ES2 gl = drawable.getGL().getGL2ES2();
+
+ st.destroy(gl);
+ st=null;
+ pmvMatrix.destroy();
+ pmvMatrix=null;
+ quit=true;
+ }
+
public void display(GLAutoDrawable drawable) {
GL2ES2 gl = drawable.getGL().getGL2ES2();
diff --git a/src/demos/es2/openmax/Cube.java b/src/demos/es2/openmax/Cube.java
index 1e194bc..d782bd3 100644
--- a/src/demos/es2/openmax/Cube.java
+++ b/src/demos/es2/openmax/Cube.java
@@ -43,6 +43,8 @@ import java.nio.*;
import com.sun.javafx.newt.*;
public class Cube implements GLEventListener {
+ boolean quit = false;
+
public Cube () {
this(false, false);
}
@@ -212,6 +214,10 @@ public class Cube implements GLEventListener {
// weird effect ..: gl.glCullFace(gl.GL_FRONT);
}
+ public void dispose(GLAutoDrawable drawable) {
+ quit=true;
+ }
+
public void display(GLAutoDrawable drawable) {
GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL());
@@ -352,12 +358,12 @@ public class Cube implements GLEventListener {
window.setFullscreen(true);
window.setVisible(true);
- while (window.getDuration() < 31000) {
+ while (!quit && window.getDuration() < 31000) {
window.display();
}
// Shut things down cooperatively
- window.close();
+ window.destroy();
window.getFactory().shutdown();
System.out.println("Cube shut down cleanly.");
} catch (Throwable t) {
diff --git a/src/demos/es2/openmax/MovieCube.java b/src/demos/es2/openmax/MovieCube.java
index 1c98f70..7e6c588 100755
--- a/src/demos/es2/openmax/MovieCube.java
+++ b/src/demos/es2/openmax/MovieCube.java
@@ -113,10 +113,10 @@ public class MovieCube implements MouseListener, GLEventListener, OMXEventListen
// Shut things down cooperatively
if(null!=movie) {
- movie.dispose(null);
+ movie.destroy(window.getGL());
movie=null;
}
- window.close();
+ window.destroy();
window.getFactory().shutdown();
System.out.println("MovieCube shut down cleanly.");
} catch (Throwable t) {
@@ -183,6 +183,16 @@ public class MovieCube implements MouseListener, GLEventListener, OMXEventListen
System.out.println("reshape "+width+"x"+height);
}
+ public void dispose(GLAutoDrawable drawable) {
+ GL2ES2 gl = drawable.getGL().getGL2ES2();
+
+ movie.destroy(gl);
+ movie=null;
+ cube.dispose(drawable);
+ cube=null;
+ quit=true;
+ }
+
public void display(GLAutoDrawable drawable) {
GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL());
diff --git a/src/demos/es2/openmax/MovieSimple.java b/src/demos/es2/openmax/MovieSimple.java
index a58156b..c626bc2 100755
--- a/src/demos/es2/openmax/MovieSimple.java
+++ b/src/demos/es2/openmax/MovieSimple.java
@@ -48,7 +48,6 @@ import java.net.*;
import com.sun.javafx.newt.*;
public class MovieSimple implements MouseListener, GLEventListener, OMXEventListener {
-
private GLWindow window;
private boolean quit = false;
private boolean rotate = false;
@@ -119,10 +118,10 @@ public class MovieSimple implements MouseListener, GLEventListener, OMXEventList
// Shut things down cooperatively
if(null!=movie) {
- movie.dispose(null);
+ movie.destroy(window.getGL());
movie=null;
}
- window.close();
+ window.destroy();
window.getFactory().shutdown();
System.out.println("MovieSimple shut down cleanly.");
} catch (Throwable t) {
@@ -278,6 +277,18 @@ public class MovieSimple implements MouseListener, GLEventListener, OMXEventList
st.glUseProgram(gl, false);
}
+ public void dispose(GLAutoDrawable drawable) {
+ GL2ES2 gl = drawable.getGL().getGL2ES2();
+
+ movie.destroy(gl);
+ movie=null;
+ pmvMatrix.destroy();
+ pmvMatrix=null;
+ st.destroy(gl);
+ st=null;
+ quit=true;
+ }
+
public void display(GLAutoDrawable drawable) {
GL2ES2 gl = drawable.getGL().getGL2ES2();
diff --git a/src/demos/es2/perftst/Perftst.java b/src/demos/es2/perftst/Perftst.java
index d67f827..d27ba9e 100755
--- a/src/demos/es2/perftst/Perftst.java
+++ b/src/demos/es2/perftst/Perftst.java
@@ -72,7 +72,7 @@ public class Perftst implements MouseListener, GLEventListener {
window.display();
// Shut things down cooperatively
- window.close();
+ window.destroy();
window.getFactory().shutdown();
System.out.println("Perftst shut down cleanly.");
} catch (Throwable t) {
@@ -139,6 +139,17 @@ public class Perftst implements MouseListener, GLEventListener {
st.glUseProgram(gl, false);
}
+ public void dispose(GLAutoDrawable drawable) {
+ GL2ES2 gl = drawable.getGL().getGL2ES2();
+
+ st.destroy(gl);
+ st=null;
+ pmvMatrix.destroy();
+ pmvMatrix=null;
+ quit=true;
+ }
+
+
public void display(GLAutoDrawable drawable) {
pmod.run(drawable, 10);
}
diff --git a/src/demos/fullscreen/FullscreenWorkaround.java b/src/demos/fullscreen/FullscreenWorkaround.java
index 39c689c..b337db7 100755
--- a/src/demos/fullscreen/FullscreenWorkaround.java
+++ b/src/demos/fullscreen/FullscreenWorkaround.java
@@ -75,6 +75,9 @@ public class FullscreenWorkaround implements GLEventListener {
}
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {}
public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {}
public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {}
diff --git a/src/demos/gears/Gears.java b/src/demos/gears/Gears.java
index ba02ef4..4b2e431 100644
--- a/src/demos/gears/Gears.java
+++ b/src/demos/gears/Gears.java
@@ -127,6 +127,10 @@ public class Gears implements GLEventListener, MouseListener, MouseMotionListene
gl.glTranslatef(0.0f, 0.0f, -40.0f);
}
+ public void dispose(GLAutoDrawable drawable) {
+ System.out.println("Gears.dispose: "+drawable);
+ }
+
public void display(GLAutoDrawable drawable) {
// Turn the gears' teeth
angle += 2.0f;
diff --git a/src/demos/hdr/HDR.java b/src/demos/hdr/HDR.java
index 5aedd53..2c86f30 100755
--- a/src/demos/hdr/HDR.java
+++ b/src/demos/hdr/HDR.java
@@ -379,6 +379,9 @@ public class HDR extends Demo {
initComplete = true;
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
// printThreadName("display for Listener");
diff --git a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java
index f287053..160e363 100644
--- a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java
+++ b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java
@@ -322,6 +322,11 @@ public class HWShadowmapsSimple extends Demo {
}
+ public void dispose(GLAutoDrawable drawable) {
+ glu = null;
+ glut = null;
+ }
+
public void display(GLAutoDrawable drawable) {
viewer.update();
@@ -442,6 +447,9 @@ public class HWShadowmapsSimple extends Demo {
fullyInitialized = true;
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
diff --git a/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java b/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java
index 9e648d3..ef4d67a 100644
--- a/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java
+++ b/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java
@@ -317,6 +317,22 @@ public class InfiniteShadowVolumes extends Demo {
// glutAddMenuEntry("quit [<esc>]", 27);
}
+ public void dispose(GLAutoDrawable drawable) {
+ GL2 gl = drawable.getGL().getGL2();
+
+ gl.glDeleteLists(faceDisplayList, 1);
+ faceDisplayList=0;
+
+ int[] tmp = new int[1];
+ tmp[0]=wallTexObject;
+ gl.glDeleteTextures(1, tmp, 0);
+ wallTexObject = 0;
+
+ objectManip = null;
+ lightManip = null;
+ viewer = null;
+ }
+
public void display(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
diff --git a/src/demos/j2d/CustomText.java b/src/demos/j2d/CustomText.java
index 5072579..bfcbc79 100755
--- a/src/demos/j2d/CustomText.java
+++ b/src/demos/j2d/CustomText.java
@@ -237,6 +237,9 @@ public class CustomText extends Demo {
gl.setSwapInterval(0);
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
time.update();
diff --git a/src/demos/j2d/FlyingText.java b/src/demos/j2d/FlyingText.java
index 82ae950..f46dac2 100755
--- a/src/demos/j2d/FlyingText.java
+++ b/src/demos/j2d/FlyingText.java
@@ -277,6 +277,13 @@ public class FlyingText extends Demo {
gl.setSwapInterval(0);
}
+ public void dispose(GLAutoDrawable drawable) {
+ backgroundTexture = null;
+ renderer = null;
+ fps = null;
+ time = null;
+ }
+
public void display(GLAutoDrawable drawable) {
time.update();
diff --git a/src/demos/j2d/TestOverlay.java b/src/demos/j2d/TestOverlay.java
index a5a6fa6..59dcd8f 100755
--- a/src/demos/j2d/TestOverlay.java
+++ b/src/demos/j2d/TestOverlay.java
@@ -124,6 +124,13 @@ public class TestOverlay implements GLEventListener {
font = new Font("SansSerif", Font.BOLD, 36);
}
+ public void dispose(GLAutoDrawable drawable) {
+ font = null;
+ overlay = null;
+ time = null;
+ position = null;
+ }
+
public void display(GLAutoDrawable drawable) {
if (startTime == 0) {
startTime = System.currentTimeMillis();
diff --git a/src/demos/j2d/TestTextRenderer.java b/src/demos/j2d/TestTextRenderer.java
index 035f3fd..4737ac5 100755
--- a/src/demos/j2d/TestTextRenderer.java
+++ b/src/demos/j2d/TestTextRenderer.java
@@ -124,6 +124,12 @@ public class TestTextRenderer implements GLEventListener {
fps = new FPSCounter(drawable, 36);
}
+ public void dispose(GLAutoDrawable drawable) {
+ renderer = null;
+ position = null;
+ time = null;
+ }
+
public void display(GLAutoDrawable drawable) {
time.update();
diff --git a/src/demos/j2d/TestTextureRenderer.java b/src/demos/j2d/TestTextureRenderer.java
index 79cfd44..13afdfe 100755
--- a/src/demos/j2d/TestTextureRenderer.java
+++ b/src/demos/j2d/TestTextureRenderer.java
@@ -141,6 +141,13 @@ public class TestTextureRenderer implements GLEventListener {
renderer.markDirty(textBounds.x, textBounds.y, textBounds.width, textBounds.height);
}
+ public void dispose(GLAutoDrawable drawable) {
+ renderer = null;
+ textBounds = null;
+ position = null;
+ time = null;
+ }
+
public void display(GLAutoDrawable drawable) {
if (startTime == 0) {
startTime = System.currentTimeMillis();
diff --git a/src/demos/j2d/TextCube.java b/src/demos/j2d/TextCube.java
index 27d2541..1ef3144 100755
--- a/src/demos/j2d/TextCube.java
+++ b/src/demos/j2d/TextCube.java
@@ -120,6 +120,9 @@ public class TextCube extends Demo {
// gl.setSwapInterval(0);
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);
diff --git a/src/demos/j2d/TextFlow.java b/src/demos/j2d/TextFlow.java
index 478f0bb..91951e0 100755
--- a/src/demos/j2d/TextFlow.java
+++ b/src/demos/j2d/TextFlow.java
@@ -148,6 +148,11 @@ public class TextFlow extends Demo {
((SystemTime) time).rebase();
}
+ public void dispose(GLAutoDrawable drawable) {
+ renderer = null;
+ time = null;
+ }
+
public void display(GLAutoDrawable drawable) {
time.update();
diff --git a/src/demos/misc/Picking.java b/src/demos/misc/Picking.java
index 9d50284..1c05178 100755
--- a/src/demos/misc/Picking.java
+++ b/src/demos/misc/Picking.java
@@ -82,6 +82,9 @@ public class Picking
glu.gluOrtho2D(0.0f,1.0f,0.0f,1.0f);
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable)
{
GL2 gl = drawable.getGL().getGL2();
diff --git a/src/demos/multisample/Multisample.java b/src/demos/multisample/Multisample.java
index 2fb76b3..91f57c3 100755
--- a/src/demos/multisample/Multisample.java
+++ b/src/demos/multisample/Multisample.java
@@ -137,6 +137,9 @@ public class Multisample {
gl.glOrtho(-1, 1, -1, 1, -1, 1);
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
diff --git a/src/demos/nurbs/curveapp/GLListener.java b/src/demos/nurbs/curveapp/GLListener.java
index 27d8f5f..3a1f47a 100755
--- a/src/demos/nurbs/curveapp/GLListener.java
+++ b/src/demos/nurbs/curveapp/GLListener.java
@@ -52,6 +52,13 @@ public class GLListener implements GLEventListener {
gl.glClearColor(1, 1, 1, 1);
}
+ public void dispose(GLAutoDrawable drawable) {
+ this.gl = null;
+ this.glu = null;
+ this.glut=null;
+ this.nurbs = null;
+ }
+
/* (non-Javadoc)
* @see javax.media.opengl.GLEventListener#display(javax.media.opengl.GLAutoDrawable)
*/
diff --git a/src/demos/nurbs/surfaceapp/GLListener.java b/src/demos/nurbs/surfaceapp/GLListener.java
index ca266f0..ced405d 100755
--- a/src/demos/nurbs/surfaceapp/GLListener.java
+++ b/src/demos/nurbs/surfaceapp/GLListener.java
@@ -128,6 +128,13 @@ public class GLListener implements GLEventListener {
gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL2.GL_NICEST);
}
+ public void dispose(GLAutoDrawable drawable) {
+ this.gl = null;
+ this.glu = null;
+ this.glut=null;
+ this.nurbs = null;
+ }
+
/* (non-Javadoc)
* @see javax.media.opengl.GLEventListener#display(javax.media.opengl.GLAutoDrawable)
*/
diff --git a/src/demos/particles/engine/GLComponent.java b/src/demos/particles/engine/GLComponent.java
index 52bf6af..1b56f85 100755
--- a/src/demos/particles/engine/GLComponent.java
+++ b/src/demos/particles/engine/GLComponent.java
@@ -70,6 +70,10 @@ public class GLComponent extends GLCanvas implements GLEventListener {
return caps;
}
+ public void dispose(GLAutoDrawable drawable) {
+ this.engine=null;
+ }
+
public void display(GLAutoDrawable drawable) {
final GL2 gl = drawable.getGL().getGL2();
engine.draw(gl);
diff --git a/src/demos/printext/PrintExt.java b/src/demos/printext/PrintExt.java
index 0d5e101..d2abe17 100755
--- a/src/demos/printext/PrintExt.java
+++ b/src/demos/printext/PrintExt.java
@@ -49,6 +49,9 @@ public class PrintExt {
runExit();
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
}
diff --git a/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java b/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java
index 4514238..f4dc264 100644
--- a/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java
+++ b/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java
@@ -219,6 +219,13 @@ public class ProceduralTexturePhysics extends Demo {
}
}
+ public void dispose(GLAutoDrawable drawable) {
+ water.destroy();
+ water = null;
+ viewer = null;
+ timer = null;
+ }
+
public void display(GLAutoDrawable drawable) {
if (++frameCount == 30) {
timer.stop();
diff --git a/src/demos/proceduralTexturePhysics/Water.java b/src/demos/proceduralTexturePhysics/Water.java
index cf3287a..8304b6a 100644
--- a/src/demos/proceduralTexturePhysics/Water.java
+++ b/src/demos/proceduralTexturePhysics/Water.java
@@ -445,6 +445,9 @@ public class Water {
initOpenGL(gl);
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
diff --git a/src/demos/tess/Tess.java b/src/demos/tess/Tess.java
index c7bde54..1137c15 100644
--- a/src/demos/tess/Tess.java
+++ b/src/demos/tess/Tess.java
@@ -186,6 +186,10 @@ public class Tess {
public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
}
+ public void dispose(GLAutoDrawable drawable) {
+ gl = null;
+ }
+
public void display(GLAutoDrawable drawable) {
gl.glClear(GL2.GL_COLOR_BUFFER_BIT);
gl.glColor3d(1.0, 1.0, 1.0);
diff --git a/src/demos/testContextDestruction/TestContextDestruction.java b/src/demos/testContextDestruction/TestContextDestruction.java
index 64cc4a7..d0c3a8f 100755
--- a/src/demos/testContextDestruction/TestContextDestruction.java
+++ b/src/demos/testContextDestruction/TestContextDestruction.java
@@ -216,6 +216,9 @@ public class TestContextDestruction {
reshape(drawable, 0, 0, drawable.getWidth(), drawable.getHeight());
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
angle += 2.0f;
diff --git a/src/demos/testContextSharing/TestContextSharing.java b/src/demos/testContextSharing/TestContextSharing.java
index ac1a0ff..84faf6f 100644
--- a/src/demos/testContextSharing/TestContextSharing.java
+++ b/src/demos/testContextSharing/TestContextSharing.java
@@ -122,6 +122,9 @@ public class TestContextSharing {
gl.glEnable(GL2.GL_NORMALIZE);
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
diff --git a/src/demos/texture/TestSubImage.java b/src/demos/texture/TestSubImage.java
index 3ff20d1..0024e50 100755
--- a/src/demos/texture/TestSubImage.java
+++ b/src/demos/texture/TestSubImage.java
@@ -109,6 +109,9 @@ public class TestSubImage {
gl.glLoadIdentity();
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
diff --git a/src/demos/texture/TestTexture.java b/src/demos/texture/TestTexture.java
index 85876a3..3ece9ef 100755
--- a/src/demos/texture/TestTexture.java
+++ b/src/demos/texture/TestTexture.java
@@ -166,6 +166,9 @@ public class TestTexture implements GLEventListener {
gl.glLoadIdentity();
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
diff --git a/src/demos/vertexArrayRange/VertexArrayRange.java b/src/demos/vertexArrayRange/VertexArrayRange.java
index cffe305..c97428b 100644
--- a/src/demos/vertexArrayRange/VertexArrayRange.java
+++ b/src/demos/vertexArrayRange/VertexArrayRange.java
@@ -460,6 +460,9 @@ public class VertexArrayRange extends Demo {
}
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
diff --git a/src/demos/vertexBufferObject/VertexBufferObject.java b/src/demos/vertexBufferObject/VertexBufferObject.java
index 27ab5e8..9998f15 100644
--- a/src/demos/vertexBufferObject/VertexBufferObject.java
+++ b/src/demos/vertexBufferObject/VertexBufferObject.java
@@ -463,6 +463,9 @@ public class VertexBufferObject extends Demo {
}
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
if (!initComplete) {
return;
diff --git a/src/demos/vertexProgRefract/VertexProgRefract.java b/src/demos/vertexProgRefract/VertexProgRefract.java
index 408ec53..693d0a2 100644
--- a/src/demos/vertexProgRefract/VertexProgRefract.java
+++ b/src/demos/vertexProgRefract/VertexProgRefract.java
@@ -348,6 +348,9 @@ public class VertexProgRefract extends Demo {
initComplete = true;
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
if (!initComplete) {
return;
diff --git a/src/demos/vertexProgWarp/VertexProgWarp.java b/src/demos/vertexProgWarp/VertexProgWarp.java
index 1e51beb..03f42ae 100644
--- a/src/demos/vertexProgWarp/VertexProgWarp.java
+++ b/src/demos/vertexProgWarp/VertexProgWarp.java
@@ -245,6 +245,9 @@ public class VertexProgWarp extends Demo {
initComplete = true;
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
if (!initComplete) {
return;
diff --git a/src/gleem/ExaminerViewer.java b/src/gleem/ExaminerViewer.java
index e22eb5f..d21579a 100644
--- a/src/gleem/ExaminerViewer.java
+++ b/src/gleem/ExaminerViewer.java
@@ -129,6 +129,7 @@ public class ExaminerViewer {
private GLEventListener glListener = new GLEventListener() {
public void init(GLAutoDrawable drawable) {}
public void display(GLAutoDrawable drawable) {}
+ public void dispose(GLAutoDrawable drawable) { }
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
reshapeMethod(width, height);
}
diff --git a/src/gleem/TestExaminerViewer.java b/src/gleem/TestExaminerViewer.java
index 804c578..03f4a00 100644
--- a/src/gleem/TestExaminerViewer.java
+++ b/src/gleem/TestExaminerViewer.java
@@ -132,6 +132,9 @@ public class TestExaminerViewer {
viewer.viewAll(gl);
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
diff --git a/src/gleem/TestHandleBox.java b/src/gleem/TestHandleBox.java
index fd8fe31..8be4a7d 100644
--- a/src/gleem/TestHandleBox.java
+++ b/src/gleem/TestHandleBox.java
@@ -104,6 +104,9 @@ public class TestHandleBox {
manager.showManipInWindow(manip, (AWTGLAutoDrawable) drawable);
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
diff --git a/src/gleem/TestMultiWin.java b/src/gleem/TestMultiWin.java
index d398299..ae78828 100644
--- a/src/gleem/TestMultiWin.java
+++ b/src/gleem/TestMultiWin.java
@@ -131,6 +131,9 @@ public class TestMultiWin {
viewer.viewAll(gl);
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
diff --git a/src/gleem/TestTranslate1.java b/src/gleem/TestTranslate1.java
index 8708074..fae4366 100644
--- a/src/gleem/TestTranslate1.java
+++ b/src/gleem/TestTranslate1.java
@@ -105,6 +105,9 @@ public class TestTranslate1 {
manager.showManipInWindow(manip, (AWTGLAutoDrawable) drawable);
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
diff --git a/src/gleem/TestTranslate2.java b/src/gleem/TestTranslate2.java
index 9255a7f..ea1ae0e 100644
--- a/src/gleem/TestTranslate2.java
+++ b/src/gleem/TestTranslate2.java
@@ -105,6 +105,9 @@ public class TestTranslate2 {
manager.showManipInWindow(manip, (AWTGLAutoDrawable) drawable);
}
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
public void display(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
diff --git a/src/jbullet/src/javabullet/demos/opengl/DemoApplication.java b/src/jbullet/src/javabullet/demos/opengl/DemoApplication.java
index fb03ee9..18c0bae 100644
--- a/src/jbullet/src/javabullet/demos/opengl/DemoApplication.java
+++ b/src/jbullet/src/javabullet/demos/opengl/DemoApplication.java
@@ -202,6 +202,10 @@ public abstract class DemoApplication
gl.glCullFace(gl.GL_BACK);
}
+ public void dispose(GLAutoDrawable drawable) {
+ gl=null;
+ }
+
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
gl = drawable.getGL();
glutScreenWidth = width;
diff --git a/src/jbullet/src/javabullet/demos/opengl/JOGL.java b/src/jbullet/src/javabullet/demos/opengl/JOGL.java
index ac5b43e..451b362 100644
--- a/src/jbullet/src/javabullet/demos/opengl/JOGL.java
+++ b/src/jbullet/src/javabullet/demos/opengl/JOGL.java
@@ -35,11 +35,17 @@ import java.nio.*;
* @author jezek2
*/
-public class JOGL implements MouseListener {
+public class JOGL implements WindowListener, MouseListener {
private GLWindow window;
public boolean quit = false;
+ public void windowResized(WindowEvent e) { }
+ public void windowMoved(WindowEvent e) { }
+ public void windowDestroyNotify(WindowEvent e) {
+ quit = true;
+ }
+
public void mouseClicked(MouseEvent e) {
//if(e.getClickCount()>1) {
quit=true;
@@ -84,6 +90,7 @@ public class JOGL implements MouseListener {
}
window = GLWindow.create(nWindow, caps);
+ window.addWindowListener(this);
window.addMouseListener(this);
window.addMouseListener(demoApp);
window.addKeyListener(demoApp);
@@ -104,7 +111,7 @@ public class JOGL implements MouseListener {
}
// Shut things down cooperatively
- window.close();
+ window.destroy();
window.getFactory().shutdown();
System.out.print(title);
System.out.println(" shut down cleanly.");