summaryrefslogtreecommitdiffstats
path: root/src/demos/cubefbo/FBCubes.java
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 /src/demos/cubefbo/FBCubes.java
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
Diffstat (limited to 'src/demos/cubefbo/FBCubes.java')
-rwxr-xr-xsrc/demos/cubefbo/FBCubes.java22
1 files changed, 19 insertions, 3 deletions
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();