I'm using OpenGL on windows (have been for a while now), and I've come across a strange issue.

Once every so often, the rate at which frames are presented on the screen drops to roughly 10 fps. However, my framerate counter stays at the usual framerate (2000fps in the menu, 300fps in game).

My framerate counter is based on the time between draw calls, so the graphics card is definitly rendering 2000 frames a second.

What is the problem? How can I fix it?

EDIT: I forgot to mention, this only happens when running in windowed mode.

  • 2
    \$\begingroup\$ You need to profile your code. \$\endgroup\$ Commented Aug 10, 2011 at 20:21

1 Answer 1


Definitely rendering at 2000 fps? Nah, I guess you're measuring elapsed frame time like usual, which means you're measuring time it took for the driver to generate the GPU commands and not the time it took the GPU to actually render the frame. After a while CPU waits for the GPU to catch up and it shows as spike in frame time.

As for possible reasons... Well, it could be everything starting from bad hardware or drivers and ending with bad code. Try to do the simplest graphics call possible:

  // This should use QueryPerformanceCounter/QueryPerformanceFrequency

And then see if it still spikes. If it doesn't, add a code until it spikes again, and if it does, then it's a technical issue. For additional confirmation enable VSync and see if spiking rate changes. Launch a HWMonitor and see if temperatures and voltages are OK, check System Event Log, use GPUView with xperf, maybe try to somehow debug it with gDEBugger, change drivers, change hardware... Possibilities are endless :)

EDIT: Maik Semder actually gave a better advice :) Your problem may be completely unrelated to the video at all, so check what you're doing every frame, look at the GC, wrap different OpenGL calls with QueryPerformanceCounter.

  • \$\begingroup\$ Definitly 2000 fps. I mesure the time it takes for the CPU to issue the commands too. It takes the GPU 0.4ms to render, and the CPU 0.06ms to issue the drawing commands. I should not that this problem doesn't happen in fullscreen. \$\endgroup\$
    – Hannesh
    Commented Aug 11, 2011 at 9:49
  • \$\begingroup\$ Sounds esoteric. If your fps drop, and you counter says its still 2000 fps, either fps didn't drop or your counter is wrong :) Maybe there is some third possibility, but it's hard to guess without looking at your code and pc. Windowed mode differs from fullscreen in it's need to render both your graphics and the other desktop windows, also it will never have vsync on. Disable all background apps if you haven't tried it yet, maybe some of them is interfering in some way. Back to the GPU theory, you can launch GPU-Z and look at GPU utilization at the moment of fps spike, look for a drop. \$\endgroup\$
    – EnoughTea
    Commented Aug 12, 2011 at 7:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .