Question about the FPS calculation

Dec 12, 2011 at 7:10 AM

I am running the CameraControlDemo and have activated the FPS counter. The FPS stays around 55FPS when I do nothing. When I rotate via mouse, it rises to about 110-120FPS. When I rotate via keyboard, it goes down to about 40FPS.

My question is:

Why do FPS rise when rotating via mouse, but go down when rotating via keyboard?

 

Best Regards

Bernd

Coordinator
Dec 12, 2011 at 7:40 PM

hi Bernd, the fps counter is counting frames by the CompositionTarget.Rendering event, which should fire at around 60Hz when the model is not too big. I think the mouse events have higher frequency and will force more frequent updates of the model, but I have not investigated how this works. I don't know why it goes down when using the keyboard, could it have something to do with the keyboard repetition rate?

http://msdn.microsoft.com/en-us/library/system.windows.media.compositiontarget.rendering.aspx 

Dec 13, 2011 at 7:33 AM

The background of my question is that FPS calculation seems to be wrong for larger objects.

When I have objects with like 200 000 triangles, the FPS when rotating via keyboard is like 5 FPS.

The FPS when rotating via mouse is like 80 FPS. The 80 FPS cannot be true, because it does not look smooth anymore.

 

I was just wondering why there is this difference in FPS calculation, but it is not really a problem...

 

Best Regards

Bernd

Coordinator
Dec 13, 2011 at 5:42 PM

Right, using the CompositionTarget.Rendering event is probably not an accurate method of calculate the frame rate.

Let us know if you find a better way to achieve this! (is there some other event in the WPF3D render loop that could be used?)