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