diff options
author | Sven Gothel <[email protected]> | 2008-06-02 08:22:14 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2008-06-02 08:22:14 +0000 |
commit | 665ee403e75d7024f660993713a537234a2d0826 (patch) | |
tree | d56497d3232861a9f3db4872f6eaec864a080439 /src/demos | |
parent | 16221e43701daee0f138beec1e86fae8a472a9da (diff) |
added fps 2 stdout, changed reshape ..
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/trunk@244 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
Diffstat (limited to 'src/demos')
-rwxr-xr-x | src/demos/es1/angeles/Angeles.java | 26 | ||||
-rwxr-xr-x | src/demos/es1/angeles/Main.java | 15 |
2 files changed, 32 insertions, 9 deletions
diff --git a/src/demos/es1/angeles/Angeles.java b/src/demos/es1/angeles/Angeles.java index 6d689b6..c298adb 100755 --- a/src/demos/es1/angeles/Angeles.java +++ b/src/demos/es1/angeles/Angeles.java @@ -111,18 +111,26 @@ public class Angeles /* implements GLEventListener */ { this.gl = gl; + gl.glMatrixMode(gl.GL_MODELVIEW); + gl.glLoadIdentity(); + gl.glClearColorx((int)(0.1f * 65536), (int)(0.2f * 65536), (int)(0.3f * 65536), 0x10000); - gl.glClear(gl.GL_DEPTH_BUFFER_BIT | gl.GL_COLOR_BUFFER_BIT); - gl.glMatrixMode(gl.GL_PROJECTION); - gl.glLoadIdentity(); - gluPerspective(45.0f, (float)width / (float)height, 0.5f, 150.0f); + gl.glCullFace(GL.GL_FRONT); - gl.glMatrixMode(gl.GL_MODELVIEW); + gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_FASTEST); - gl.glLoadIdentity(); + //gl.glShadeModel(GL.GL_SMOOTH); + gl.glShadeModel(GL.GL_FLAT); + gl.glDisable(GL.GL_DITHER); + + //gl.glMatrixMode(gl.GL_PROJECTION); + //gl.glLoadIdentity(); + //gluPerspective(45.0f, (float)width / (float)height, 0.5f, 150.0f); + + System.out.println("reshape .."); } public void display(GL gl) { @@ -143,7 +151,11 @@ public class Angeles /* implements GLEventListener */ { return; } - reshape(gl, 0, 0, width, height); + gl.glClear(gl.GL_DEPTH_BUFFER_BIT | gl.GL_COLOR_BUFFER_BIT); + + gl.glMatrixMode(gl.GL_PROJECTION); + gl.glLoadIdentity(); + gluPerspective(45.0f, (float)width / (float)height, 0.5f, 150.0f); // Update the camera position and set the lookat. camTrack(); diff --git a/src/demos/es1/angeles/Main.java b/src/demos/es1/angeles/Main.java index b5b74d0..20a9f0a 100755 --- a/src/demos/es1/angeles/Main.java +++ b/src/demos/es1/angeles/Main.java @@ -69,12 +69,24 @@ public class Main implements MouseListener { angel.reshape(gl, 0, 0, window.getWidth(), window.getHeight()); long startTime = System.currentTimeMillis(); - long curTime = 0; + long lastTime = startTime, curTime = 0, dt0, dt1; + int totalFrames = 0, lastFrames = 0; do { angel.display(gl); drawable.swapBuffers(); + totalFrames++; lastFrames++; + curTime = System.currentTimeMillis(); + dt0 = curTime-lastTime; + if ( (curTime-lastTime) > 5000 ) { + dt1 = curTime-startTime; + System.out.println(curTime/1000+"s, 5s: "+ (lastFrames*1000)/dt0 + " fps, "+ + "total: "+ (totalFrames*1000)/dt1 + " fps"); + lastTime=curTime; + lastFrames=0; + } + if(ml.toggleFS) { window.setFullscreen(!window.isFullscreen()); ml.toggleFS=false; @@ -87,7 +99,6 @@ public class Main implements MouseListener { // try{ // Thread.sleep(10); // } catch(InterruptedException ie) {} - curTime = System.currentTimeMillis(); } while (!ml.quit && (curTime - startTime) < 215000); // Shut things down cooperatively |