summaryrefslogtreecommitdiffstats
path: root/src/demos/es1
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2008-05-30 08:43:05 +0000
committerKenneth Russel <[email protected]>2008-05-30 08:43:05 +0000
commit77c64bdaf1e6710a0a46557aac38ac45c70153c8 (patch)
treee530f500b423c77d12ff729af6f60a2d2b7f4eec /src/demos/es1
parent98072b0c325efb3a226dbf1f8e74c5db88d0a862 (diff)
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
Diffstat (limited to 'src/demos/es1')
-rwxr-xr-xsrc/demos/es1/RedSquare.java16
1 files changed, 13 insertions, 3 deletions
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);