0

I have created a little program that runs openGL ES 1.1; I also used Log to print my fps. There is something strange though, when i check the log the fps counter says that each frame i got more than 2000 fps. How is that even possible? If i am not mistake vsync automatically cap your upper frame limit to 60. Thanks in advance.

public class FPSCounter {
long startTime = System.nanoTime();
int frames = 0;

public void logFrame() {
    frames++;
    if(System.nanoTime() - startTime >= 1000000000) {
        Log.d("FPSCounter", "fps: " + frames);
        startTime = System.nanoTime();
    }
}

}

KostasRim
  • 2,053
  • 1
  • 16
  • 32
  • 1
    Is this the real code? What you log here is just a count of the frames. You never divide by the time to get a frame rate. – Reto Koradi Oct 12 '14 at 14:34
  • i increment the frame var and then check if 1 second has passed, if its true then i reset the time. Now i see i dont reset the frame var :/ – KostasRim Oct 12 '14 at 15:02

1 Answers1

0

Reset your counter frames.

 if(System.nanoTime() - startTime >= 1000000000) {
        Log.d("FPSCounter", "fps: " + frames);
        startTime = System.nanoTime();
        **frames = 0;**
}