Recently, a real-time display is required, so I want to display FPS on the screen. FPS is the abbreviation of frame per second. FPS is used to measure the quantity of information used to save and Display Dynamic videos. In general, it refers to the number of pictures of an animation or video.
This requires meSystem FunctionsMentioned in the first lectureGettickcount, gettickfrequencyThese two functions. The previous function returns the number of tick times, and the latter function returns the number of tick times per second. Their ratio is time.
If you want to getProgramYou can use the following example:
Double T = (double) gettickcount (); // do something... t = (double) gettickcount ()-T)/gettickfrequency ();
The above procedures are being testedAlgorithmIs a good test program. Here I just need to rewrite this example to get the time between each frame, and then use the previousPlotting FunctionsWhat I mentioned in that sectionPuttextDisplay FPS to the screen.
But there is a problem that makes me feel uncomfortable,It is not very accurate when it is used, and it feels that the time is faster than the actual time.. There are few tests and you are not afraid to talk about them. You are welcome to test and give your comments.
Very simple, source code: http://download.csdn.net/detail/yang_xian521/3957523