szbz216 / opengles-book-samples

Automatically exported from code.google.com/p/opengles-book-samples
0 stars 0 forks source link

FPS drift in Linux port #5

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. run any example
2. wait for a minute
3. read console output

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
svn rev 58

Please provide any additional information below.

The time counter in the fps calculations will drift over time because of a 
subtraction instead of a reset on line 318 of LinuxX11/Common/esUtil.c

This means that even simple examples like the Hello triangle will report a 
framerate that keeps decreasing until the timer comparison rolls over and 
everything starts over. It is only visible when running with vsync enabled or 
at a low framerate (intel driver has vsync turned on by default). If running 
with vsync the accumulated error in totaltime grows until it is > 1 frame time, 
at which point the fps report will trigger one frame early and the whole 
process begins anew.

I've attached a patch that fixes the problem.

Original issue reported on code.google.com by geb...@gmail.com on 3 Mar 2012 at 7:04

Attachments: