1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| void print_fps(){
int viewport[] = new int[4];
if(start == 0) start = System.currentTimeMillis();
if(System.currentTimeMillis() - start >=500){ fps = count_fps<<1; start = 0; count_fps = 0; }
count_fps++;
gl.glPushMatrix(); gl.glLoadIdentity(); gl.glMatrixMode(gl.GL_PROJECTION); gl.glPushMatrix (); gl.glLoadIdentity();
gl.glGetIntegerv (gl.GL_VIEWPORT, viewport); glu.gluOrtho2D(0,viewport[2], viewport[3], 0); gl.glDepthFunc(gl.GL_ALWAYS); gl.glColor3f (1,1,1); gl.glRasterPos2f(15, 15);
glut.glutBitmapString(gl,glut.BITMAP_HELVETICA_18, "FPS: " + fps);
gl.glDepthFunc(gl.GL_LESS); gl.glPopMatrix(); gl.glMatrixMode(gl.GL_MODELVIEW); gl.glPopMatrix (); } |
Enjoy

PS; I was working on my stencil shadows demo and I realized how freaking awesome display lists are, check these two screens out:
http://www.realityflux.com/abba/no_display_list.jpghttp://www.realityflux.com/abba/with_display_list.jpgDOH

Knowing that the dragon loaded into the demo counts no less than 6775 triangles, it's a quite a good thing to know that the cpu load that used to go "wasted" on drawing that many polyons in every frame could be put into good use somewhere else :p
At this point I might as well drop college, gf, and work and focus mainly on doing jog....j/k

Awesome
