C++ - Frame Rate Inconsistent Between Runs of OpenGL Software - Stack Overflow
C++ - Frame Rate Inconsistent Between Runs of OpenGL Software - Stack Overflow
I'm developing with: Windows 10 Pro 64-bit, Visual Studio 2015, OpenGL, GLFW
I've written software that renders video to a secondary monitor in full-screen mode. The first time I
1
compile and run the code, it will render at frame rates just over approximately 200 FPS. Sometimes I
can stop and re-run the same executable (either from Windows explorer or directly from within Visual
Studio) and the same frame rate is reported. But then, inexplicably, I'll run it and the frame rate drops to
about 60 FPS.
I know that this would seem to be a vsync issue. But the secondary monitor I'm rendering to has a
refresh rate of 120 Hz. Furthermore, I set glfwSwapInterval(0) from the get-go which should make the
software run independent of the vsync signal. (I literally want to render at the fastest frame rate possible
<= but do this repeatably ... eventually, I plan to implement my own 'sleep' or 'wait' function to slow it
down. But, right now, I just need to get consistent frame performance).
This seems to me to be operating system dependent. So I downloaded System Explorer software and
set the priority of this software to 'Real Time' but that does not seem to solve the problem.
What could possibly be causing this frame slowdown from just under 5 ms per frame to over 16 ms?
What can I do to get my software to run unhindered by the operating system?
Share Improve this question Follow asked Mar 22, 2017 at 15:49
efpkop
61 4
How do you measure performance? For GPU performance you should use timer query objects. – pleluron Mar 22,
2017 at 15:56
Does it also happens if you render to the primary monitor? – Ripi2 Mar 22, 2017 at 16:50
@pleluron, I'm measuring performance using the StopWatchInterface class that is provided by NVidia as part of
their Cuda SDK (described in the helper_timer.h header there). I'm assuming this will be accurate in describing
GPU performance. – efpkop Mar 22, 2017 at 21:38
@Ripi2, yes - even when I render full screen to the main display, I'm seeing the same performance issues.
– efpkop Mar 22, 2017 at 21:40
Are the two displays driven by the same graphics card? – Nico Schertler Mar 23, 2017 at 8:27
Try eliminating parameters : make sure there are no other processes running in parallel, load the source data in
memory before rendering the video to avoid disk accesses, make sure your code doesn't rely on any other
externals (like network). If that doesn't point you in a direction, run the code in a profiler to figure out where that
extra time is spent. – Sander De Dycker Mar 23, 2017 at 8:32
Related questions
https://stackoverflow.com/questions/42956613/frame-rate-inconsistent-between-runs-of-opengl-software 1/2
4/7/24, 4:19 PM c++ - Frame rate inconsistent between runs of OpenGL software - Stack Overflow
https://stackoverflow.com/questions/42956613/frame-rate-inconsistent-between-runs-of-opengl-software 2/2