[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx/jni GzzGL-jni.cxx
From: |
Matti Katila |
Subject: |
[Gzz-commits] gzz/gfx/jni GzzGL-jni.cxx |
Date: |
Wed, 25 Sep 2002 13:57:56 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Matti Katila <address@hidden> 02/09/25 13:57:56
Modified files:
gfx/jni : GzzGL-jni.cxx
Log message:
Frame rate counter framework - make rungl DBG="-G JNI.fps -G
JNI.fps_console" ;)
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/jni/GzzGL-jni.cxx.diff?tr1=1.33&tr2=1.34&r1=text&r2=text
Patches:
Index: gzz/gfx/jni/GzzGL-jni.cxx
diff -c gzz/gfx/jni/GzzGL-jni.cxx:1.33 gzz/gfx/jni/GzzGL-jni.cxx:1.34
*** gzz/gfx/jni/GzzGL-jni.cxx:1.33 Wed Sep 25 10:45:43 2002
--- gzz/gfx/jni/GzzGL-jni.cxx Wed Sep 25 13:57:56 2002
***************
*** 30,35 ****
--- 30,42 ----
using Renderables::Renderable2;
using Renderables::TextRenderer;
+ namespace CurrentFPS {
+ // bool showFPS;
+ double current_fps;
+ double last_time;
+ }
+
+
// XXX MEMLEAK
struct RealFont {
Text::Font *f;
***************
*** 62,67 ****
--- 69,78 ----
DBGVAR(dbg, "JNI.general");
DBGVAR(dbg_event, "JNI.event");
+ // FPS
+ DBGVAR(dbg_fps, "JNI.fps");
+ DBGVAR(dbg_fps_cout, "JNI.fps_console");
+
struct JavaException { };
JNIEnv *jnienv_eventloop;
***************
*** 816,821 ****
--- 827,839 ----
*/
}
+ #include <sys/time.h>
+ double getTime() {
+ struct timeval t;
+ gettimeofday(&t, 0);
+ return t.tv_usec*1E-6 + t.tv_sec;
+ }
+
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_renderImpl
(JNIEnv *env, jclass, jint window,
jint numinds,
***************
*** 890,903 ****
}
}
- #include <sys/time.h>
- double getTime() {
- struct timeval t;
- gettimeofday(&t, 0);
- return t.tv_usec*1E-6 + t.tv_sec;
- }
JNIEXPORT jfloat JNICALL Java_gzz_gfx_gl_GL_timeRenderImpl
(JNIEnv *env, jclass, jint window, jint iters,
--- 908,922 ----
}
+ if(dbg_fps) {
+ double new_time = getTime();
+ CurrentFPS::current_fps = 1.0/(new_time - CurrentFPS::last_time);
+ DBG(dbg_fps_cout) << "CurrentFPS: " << CurrentFPS::current_fps << "\n";
+ CurrentFPS::last_time = new_time;
+ }
+
}
JNIEXPORT jfloat JNICALL Java_gzz_gfx_gl_GL_timeRenderImpl
(JNIEnv *env, jclass, jint window, jint iters,