0% found this document useful (0 votes)
44 views

3d - How To Calculate Frames Per Second in QT Graphics Application - Stack Overflow

The document discusses how to calculate the frames per second (FPS) in a Qt graphics application using OpenGL ES 2.0. It describes starting a timer when initializing OpenGL and in the paintGL function, incrementing a frame count and calculating FPS by dividing the frame count by the elapsed time from the timer.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

3d - How To Calculate Frames Per Second in QT Graphics Application - Stack Overflow

The document discusses how to calculate the frames per second (FPS) in a Qt graphics application using OpenGL ES 2.0. It describes starting a timer when initializing OpenGL and in the paintGL function, incrementing a frame count and calculating FPS by dividing the frame count by the elapsed time from the timer.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

4/7/24, 4:14 PM 3d - How to calculate Frames per second in Qt Graphics Application - Stack Overflow

How to calculate Frames per second in Qt Graphics


Application
Asked 8 years ago Modified 6 years, 4 months ago Viewed 5k times

I have an Qt based OpenGLES2.0 application, where I want to capture the FPS.

my application draw same geometry for 16 times and then try to know the FPS.
2
How can I make sure glDrawElements() has finished its job ?

I want to get the correct FPS.

Is there any way to make the glDrawElements() synchronous or Pooling the glDrawElements()
complete?

qt 3d opengl-es-2.0

Share Improve this question Follow edited Mar 21, 2016 at 12:44 asked Mar 21, 2016 at 11:17
dtech user279505
48.7k 17 116 202 129 2 6

Do you intend to draw an animation? How do you update the scene? Can you show us some code (minimal
working example)? – Lukáš Bednařík Mar 21, 2016 at 11:41

1 Answer Sorted by: Highest score (default)

https://stackoverflow.com/questions/36129607/how-to-calculate-frames-per-second-in-qt-graphics-application?rq=3 1/2
4/7/24, 4:14 PM 3d - How to calculate Frames per second in Qt Graphics Application - Stack Overflow

1. define a Timer object in application window/widget class. QTime frameTime;

2. Start the timer in initializeGL. frameTime.start();


4
3. in PaintGL

paintGL ()
{
draw_your_geometry();

++frameCount;

if (frameTime.elapsed() >= 1000)


{

double fps = frameCount / ((double)frameTime.elapsed()/1000.0);

Share Improve this answer Follow edited Dec 4, 2017 at 0:43 answered Apr 9, 2016 at 9:12
eyllanesc user279505
239k 19 185 263 129 2 6

https://stackoverflow.com/questions/36129607/how-to-calculate-frames-per-second-in-qt-graphics-application?rq=3 2/2

You might also like