Quote Originally Posted by franz View Post
What you're running into is a limitation of the (type of) operating system. OSes made for people aren't too strict on timing because there is no need for it.

Also remember two things:
  1. Debug mode generally makes your app slower
  2. Outputting stuff to console makes your app slower
Thanks for reply.

I did that, relese mode and not writing anything on console. I wrote this test code:

Qt Code:
  1. void CEditor::TimerFired() {
  2. static int rendered_frames=0;
  3. // draw here whatever
  4. m_current_level->Update(0);
  5. m_gl_drawer->updateGL();
  6. rendered_frames++;
  7.  
  8. // after 10 seconds
  9. int total_time=10000;
  10. if (m_time.elapsed()>total_time) {
  11. float fps=rendered_frames/(0.001*total_time);
  12. QString m=QString("FPS: %1. rendered frames: %2. Timer interval (ms): %3. Total time (ms): %4").arg(fps).arg(rendered_frames).arg(SIMULATION_UPDATE_INTERVAL_IN_MS).arg(total_time);
  13. QMessageBox::warning(this, "Warning", m);
  14. m_timer->stop();
  15. }
  16. }
To copy to clipboard, switch view to plain text mode 

That code will simulate my game for just 10 seconds. 20 ms interval (SIMULATION_UPDATE_INTERVAL_IN_MS) should be 50 frames per sencod. As you can see in this picture, something is wrong.



So, what do you recommend me? Does anyone know why this happens?

Thanks a lot.