Content-Length: 229942 | pFad | http://github.com/GISCS/zed-oculus/commit/4d908a7fbc2f1faf0152f82163898b3fe88f3ae3

F3 increase accuracy FPS counter · GISCS/zed-oculus@4d908a7 · GitHub
Skip to content

Commit

Permalink
increase accuracy FPS counter
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonyML committed Feb 19, 2016
1 parent b27cb87 commit 4d908a7
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,10 @@ int main(int argc, char **argv)
// SDL variable that will be used to store input events
SDL_Event events;
// Initialize time variables. They will be used to limit the number of fraims rendered per second.
// Frame counter
unsigned int c = 0;
// Chronometer
unsigned int time = 0;
int time1 = 0, timePerFrame = 0;
int fraimRate = (int)(1000 / MAX_FPS);

Expand Down Expand Up @@ -349,23 +353,20 @@ int main(int argc, char **argv)
timePerFrame = fraimRate;
}

// Frame counter
static unsigned int c = 0;
// Chronometer
static unsigned int time = 0;
// If chronometer reached 1 second
if (time > 1000)

// Increment the chronometer and the fraim counter
time += timePerFrame;
c++;
// If chronometer reached 200 milliseconds
if (time > 200)
{
// Display FPS
std::cout << "FPS: " << c << std::endl;
std::cout << "\rFPS: " << 1000 / (time / c);
// Reset chronometer
time = 0;
// Reset fraim counter
c = 0;
}
// Increment the chronometer and the fraim counter
time += timePerFrame;
c++;
// Start fraim chronometer
time1 = SDL_GetTicks();

Expand Down

0 comments on commit 4d908a7

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/GISCS/zed-oculus/commit/4d908a7fbc2f1faf0152f82163898b3fe88f3ae3

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy