summaryrefslogtreecommitdiffstats
path: root/src/demos/es1
diff options
context:
space:
mode:
Diffstat (limited to 'src/demos/es1')
-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
10 files changed, 92 insertions, 14 deletions
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) {