james_lohr's picture

Windows 7 - windowed mode, frame skipping


I'm having trouble in windowed mode whereby I get occasional periods of frame skipping.

For example, if I turn on VSync and put a stopwatch in the OnRenderFrame() method, it starts off smooth (with 16.66.. ms per frame). However, after about 20-30 seconds I start getting 2ms followed by 30ms . It's very noticeable in the game. It's definitely not an issue with my computer not being able to cope, because if I turn Vsync off and don't limit the rate, I get > 1000 fps.

I tried the following: I turned VSync off, and used my own high-resolution timer (this uses winmm.dll for high resolution sleeping) to limit the OnRenderFrame() method. Doing this, the stopwatch now reports 16.66 ms consistently, however I can still SEE the frame skipping.

The issue goes away completely if I use fullscreen mode.

Any ideas?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
migueltk's picture

I've seen something similar with the camera control for a low frame rate (30-40 frames per second). I have not clear whether it is a problem in OpenTK or in my code in any case, I think the solution is to interpolate the movement of the camera. This you can see in OpenTK Demo, where the camera movement is very smooth and not be seen jumping and of course always active VSYNC

Regards, ... Miguel

james_lohr's picture

I'm pretty certain this has nothing to do with my code. I will attempt to recreate it with the demo. The point is that it only occurs in Windowed mode on Windows 7. It also appears to happen on both my PC and latop which have vastly different configurations.