
Originally Posted by
franz
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:
- Debug mode generally makes your app slower
- 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:
void CEditor::TimerFired() {
static int rendered_frames=0;
// draw here whatever
m_current_level->Update(0);
m_gl_drawer->updateGL();
rendered_frames++;
// after 10 seconds
int total_time=10000;
if (m_time.elapsed()>total_time) {
float fps=rendered_frames/(0.001*total_time);
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
);
m_timer->stop();
}
}
void CEditor::TimerFired() {
static int rendered_frames=0;
// draw here whatever
m_current_level->Update(0);
m_gl_drawer->updateGL();
rendered_frames++;
// after 10 seconds
int total_time=10000;
if (m_time.elapsed()>total_time) {
float fps=rendered_frames/(0.001*total_time);
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);
QMessageBox::warning(this, "Warning", m);
m_timer->stop();
}
}
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.
Bookmarks