/[gzz]/gzz/gfx/jni/GzzGL-jni.cxx
ViewVC logotype

Diff of /gzz/gfx/jni/GzzGL-jni.cxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.33 by tjl, Wed Sep 25 14:45:43 2002 UTC revision 1.34 by mudyc, Wed Sep 25 17:57:56 2002 UTC
# Line 30  using Renderables::Renderable1; Line 30  using Renderables::Renderable1;
30  using Renderables::Renderable2;  using Renderables::Renderable2;
31  using Renderables::TextRenderer;  using Renderables::TextRenderer;
32    
33    namespace CurrentFPS {
34        // bool showFPS;
35        double current_fps;
36        double last_time;
37    }
38    
39    
40  // XXX MEMLEAK  // XXX MEMLEAK
41  struct RealFont {  struct RealFont {
42      Text::Font *f;      Text::Font *f;
# Line 62  Os::Window *defaultWindow; // A kludge Line 69  Os::Window *defaultWindow; // A kludge
69  DBGVAR(dbg, "JNI.general");  DBGVAR(dbg, "JNI.general");
70  DBGVAR(dbg_event, "JNI.event");  DBGVAR(dbg_event, "JNI.event");
71    
72    // FPS
73    DBGVAR(dbg_fps, "JNI.fps");
74    DBGVAR(dbg_fps_cout, "JNI.fps_console");
75    
76  struct JavaException { };  struct JavaException { };
77    
78  JNIEnv *jnienv_eventloop;  JNIEnv *jnienv_eventloop;
# Line 816  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G Line 827  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G
827        */        */
828    }    }
829    
830    #include <sys/time.h>
831    double getTime() {
832      struct timeval t;
833      gettimeofday(&t, 0);
834      return t.tv_usec*1E-6 + t.tv_sec;
835    }
836    
837  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_renderImpl  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_renderImpl
838    (JNIEnv *env, jclass, jint window,    (JNIEnv *env, jclass, jint window,
839          jint numinds,          jint numinds,
# Line 890  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G Line 908  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G
908        }        }
909    
910    
911          if(dbg_fps) {
912            double new_time = getTime();
913            CurrentFPS::current_fps = 1.0/(new_time - CurrentFPS::last_time);
914            DBG(dbg_fps_cout) << "CurrentFPS: " << CurrentFPS::current_fps << "\n";
915            CurrentFPS::last_time = new_time;
916          }
917          
918    }    }
919    
 #include <sys/time.h>  
 double getTime() {  
   struct timeval t;  
   gettimeofday(&t, 0);  
   return t.tv_usec*1E-6 + t.tv_sec;  
 }  
920    
921  JNIEXPORT jfloat JNICALL Java_gzz_gfx_gl_GL_timeRenderImpl  JNIEXPORT jfloat JNICALL Java_gzz_gfx_gl_GL_timeRenderImpl
922    (JNIEnv *env, jclass, jint window, jint iters,    (JNIEnv *env, jclass, jint window, jint iters,

Legend:
Removed from v.1.33  
changed lines
  Added in v.1.34

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26