diff options
Diffstat (limited to 'src/demos/es1/cube/Cube.java')
-rw-r--r-- | src/demos/es1/cube/Cube.java | 13 |
1 files changed, 10 insertions, 3 deletions
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) { |