sharpgl
sharpgl copied to clipboard
WPF: animation freezes (see Teapot sample) if mouse is moving over window
Not sure if SharpGL related, but this happens. Any way to fix this?
Hi! The problem is that the priority of the Dispatcher that's responsible for the drawing is not set in the constructor of the control under 'timer = new DispatcherTimer()' in OpenGLControl.xaml.cs, The default constructor put the DispatcherPriority.Background in the priority which is lower than DispatcherPriority.Input (mouse movement). Simply change the initialization of the DispatcherTimer timer in the constructor of the control and put the priority manually. (There's a constructor that get a priority) rebuild and use the rebuilt version.
Not relevant anymore but thanks anyway, maybe will be helpful for others
I agree that the issue is the dispatchtimer as Librium said, but if I'm using this library from nuget, and not from this source, I don't have access to change the dispatch timer.
Is it possible instead to use System.Timers.Timer, and then use: Application.Current.Dispatcher.BeginInvoke( this._dispatcherPriority, new Action(() => { put rendering action here }));
Then expose the _dispatcherPriority field via a public property of the usercontrol?
In case anyone has this issue still and doesnt want to rebuild the source, you can overwrite the private field using reflection
var prop = openGLControl.GetType().GetField("timer",
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
prop.SetValue(openGLControl, new DispatcherTimer(DispatcherPriority.Render));