常见的三种计算fps的方法
2015-07-19 22:29
399 查看
// 1.总平均帧率 void update(float dt) { static float _total_frames = 0.0f; static float _total_time = 0.0f; ++_total_frames; _total_time += dt; float fps = _total_frames/_total_time; } // 2.上一秒帧率 void update(float dt) { static int fps = 0; static time_t _last = time(NULL); static int _frames = 0; ++_frames; if (time(NULL) - _last == 1) { fps = _frames; _frames = 0; } } // 3.实时帧率(估算) void update(float dt) { static float fps = 0.0f; fps = 1.0/dt; if (fps > 60.0f) { fps = 60.0f; } }
相关文章推荐
- 浮动操作按钮详解
- [置顶] javascript正则表达式学习笔记之------正则表达式的创建和基本使用
- Linux C++编程环境,IDE推荐
- srping mvc 4.0 零配置
- Database
- 20150719 They helped us bring the furniture inside the house
- Web前端开发基础 第四课(CSS文字和段落排版)
- 2.6. 分发器
- 学习两天python后感
- 埃及分数
- DEC 加密和解密
- 如何写出优雅的Python
- 主成分分析和因子分析的区别
- Android屏幕适配全攻略
- C++函数参数为数组时的解析
- mongoDB备份与恢复
- The Role of DTV Network Interfaces in Media Controller Support for DVB
- 2.5. 标准路由器:Zend_Controller_Router_Rewrite
- ExecutorService线程池
- Media Controller Support for Digital Video Broadcasting1