Lag and stuttering in WPF.
I have a planetary simulation, a very basic one and when I move the blue ball around the yellow one like earth orbiting the sun, it stutters a lot.
I have 32gb of ram and a good computer, anyone have any ideas on why WPF has such bad performance when executing this code.
Here is my code: https://codeshare.io/WLNMLd
Thanks for the help!
8 Replies
Use D3DImage
what is that? a sort of timer?
It is a Direct3D surface, meaning you can render 3D objects on it very fast.
Ah ok, would that make it very difficult? Ive never used 3d shapes before
Oh, it's 2D that you are doing
I suggest making a custom control and drawing directly
Because with the layout controls it has to calculate the layout
meaning it will be slow if you want good fps
You can override the OnRender and draw from there
How? Im a complete beginner so most terms dont really make sense yet.
https://learn.microsoft.com/en-us/dotnet/api/system.windows.uielement.onrender?view=windowsdesktop-8.0
Just make a new class and inherit UIElement for example
OK thanks, Ill try to learn how to do that.