sharpgl
sharpgl copied to clipboard
DispatchTimer Priority for drawing in OpenGLControl
Hi,
Our users complained about a poor performance of our application when an OpenGLControl was open.
I tracked that down to the Dispatch timer priority which was 10 (DispatcherPriority.Send) which is the highest priority.
I lowered that priority to 7 (DispatcherPriority.Render). Doing this, reduces fps a little bit, but the rest of the application stays responsive.
Maybe that should be changed in the next Version?!
Cheers Thomas
Hi,
just as an addition to this issue:
If you add multiple controls to to your application, which are used at the same time, even the DispatcherPriority.Render might cause the application to freeze, especially when the time needed in the draw handler * the number of controls exeeds the break time (1000/Frames in ms).
I've reduced the priority to DispatcherPriority.ApplicationIdle which still works fine for me.
Cheers Thomas
Hi ThVoss, can you tell me where I can find the priority setting?
Thanks Davide
Sure,
you can find that Setting in SharpGL.WPF.OpenGLControl.cs in the OnApplyTemplate method.
Just Change: timer = new DispatcherTimer(DispatcherPriority.Render); to: timer = new DispatcherTimer(DispatcherPriority.ApplicationIdle); or: timer = new DispatcherTimer(DispatcherPriority.SystemIdle);
Cheers
Thomas