Getting delta time of OpenGL in Qt?
Solved
General and Desktop
-
wrote on 18 Nov 2022, 20:48 last edited by
Hi,
How would I get delta time/frame time of OpenGL widget in Qt?
-
Depends on what you call a frame. Is it the time CPU spends on calculations for displaying, submitting work to the driver, the driver submitting commands to the GPU, GPU executing graphics and compute shaders, presenting a framebuffer to the output device, v-blank interval, v-sync points etc. Different apps different needs.
If all you want to know is how much time passes between calls to QOpenGLWidget::paintGL then simply create a
QElapsedTimer
and call its restart() method. It will give you the time elapsed since you last called it.
1/2