papillon
28th September 2011, 23:41
I'm building a Qt4.7 application that contains a qglwidget, and I'd like to have a custom performance timer in order to have smooth rotations, translations etc.
In the qglwidget paintGL routine I have:
myTimer.start(); // initialized as QTime myTimer
DrawEverything();
int elapsed=myTimer.restart();
elapsed should contain the number of milliseconds needed to DrawEverything(). However, if the scene is empty I get a value of 16, if the opengl scene is filled with about 10000 display lists (which causes the gl viewport to be quite slow), the elapsed value is only 18, while it should be much higher, considering the amount of geometry to be drawn.
I thought that maybe QTime would probably skip time lost in opengl operations, so I decided to create a custom timer (getTimeOfDay and similar), but the results are the same.
Anybody successfully created a performance timer to be used with a qglwidget?
Thanks
In the qglwidget paintGL routine I have:
myTimer.start(); // initialized as QTime myTimer
DrawEverything();
int elapsed=myTimer.restart();
elapsed should contain the number of milliseconds needed to DrawEverything(). However, if the scene is empty I get a value of 16, if the opengl scene is filled with about 10000 display lists (which causes the gl viewport to be quite slow), the elapsed value is only 18, while it should be much higher, considering the amount of geometry to be drawn.
I thought that maybe QTime would probably skip time lost in opengl operations, so I decided to create a custom timer (getTimeOfDay and similar), but the results are the same.
Anybody successfully created a performance timer to be used with a qglwidget?
Thanks