Andos's picture

2 Target(Render/Update)Frequency problems

Problem 1:
If I set the TargetRenderFrequency or TargetUpdateFrequency to anything before the .Run() call, the values are not saved.

Problem 2:
If I (in the load event) set the frequencies to 60, this is the values I get at runtime:

Why on earth does it render so much and update so often? It completely drains all CPU available. And this is with VSync set to ON!


Comment viewing options

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

Looks like a bug. Which version are you using?

Andos's picture

The latest I assume, I just downloaded OpenTK two days ago from the front-page through the big download link :-)
I also updated to the very latest Nvidia drivers but the problem still persists.

My system:
Windows 7 64bit
Nvidia GeForce GTX 275 (nearly 2 GB of onboard video RAM)

the Fiddler's picture

As a quick test, can you please try this?

class Game : GameWindow
    int frames;
    double time;
    public Game()
        RenderFrame += (sender, e) =>
             time += e.Time;
             if (time >= 1)
                 Console.WriteLine("FPS: {0}", frames);
                 frames = time = 0;

(Leave the rest of your code intact, just add the fps counter).

Does this print 60fps or something else entirely? What happens if you leave the TargetRenderFrequency set to 0? (i.e. use Run(60) rather than Run(60, 60)).

Andos's picture

It consistently prints out 60 FPS to the console as if nothing is wrong. When I remove VSync and remove the target render/update frequency it still goes at 60FPS.
I have no setting in my graphics card to force VSync on though.

I also found that if I use an update and render frequency of 60 my keyboard movement in the 3D world gets extremely jittery as if it gets negative time-deltas every other frame (though it doesn't, I checked).

I tried printing out the time deltas for the updateFrame and render for this setting:

window.VSync = VSyncMode.On;
window.TargetRenderFrequency = 60;
window.TargetUpdateFrequency = 60;

When I don't set any TargetUpdateFrequency or RenderFrequency my ingame mouse free-fly movement goes extremely slow (at a smooth framerate and movement) as it gets some very small time deltas (like 0.00013)

I suspect something is very wrong in the frequency calculation and in which time deltas it gives to my game. No matter what the frequency is set to, the time-deltas should be inverse proportional to it so that my game movement speed is the same - but this is not the case.