summaryrefslogtreecommitdiffstats
path: root/src/demos/es2
diff options
context:
space:
mode:
Diffstat (limited to 'src/demos/es2')
-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
5 files changed, 57 insertions, 9 deletions
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);
}