From 77c64bdaf1e6710a0a46557aac38ac45c70153c8 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Fri, 30 May 2008 08:43:05 +0000 Subject: Added animation to have a visible effect. Added clean termination sequence. Changed back to using glClearColor as the reported lack of this method was apparently caused by a JIT bug. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/trunk@233 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4 --- src/demos/es1/RedSquare.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/demos') diff --git a/src/demos/es1/RedSquare.java b/src/demos/es1/RedSquare.java index d1e78be..8811f07 100755 --- a/src/demos/es1/RedSquare.java +++ b/src/demos/es1/RedSquare.java @@ -65,7 +65,7 @@ public class RedSquare { gl.glColorPointer(4, GL.GL_FLOAT, 0, colors); // OpenGL Render Settings - gl.glClearColorx(0, 0, 0, 65535); + gl.glClearColor(0, 0, 0, 1); gl.glEnable(GL.GL_DEPTH_TEST); //---------------------------------------------------------------------- @@ -74,6 +74,7 @@ public class RedSquare { long startTime = System.currentTimeMillis(); long curTime; + int ang = 0; while ((System.currentTimeMillis() - startTime) < 10000) { gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); @@ -87,6 +88,8 @@ public class RedSquare { gl.glMatrixMode(GL.GL_MODELVIEW); gl.glLoadIdentity(); gl.glTranslatef(0, 0, -10); + gl.glRotatef(ang, 0, 0, 1); + ang++; // Draw a square gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4); @@ -100,8 +103,15 @@ public class RedSquare { } catch (InterruptedException e) { } } - } catch (Exception e) { - e.printStackTrace(); + + // Shut things down cooperatively + context.release(); + context.destroy(); + drawable.setRealized(false); + factory.shutdown(); + System.out.println("RedSquare shut down cleanly."); + } catch (Throwable t) { + t.printStackTrace(); } System.exit(0); -- cgit v1.2.3