-
Notifications
You must be signed in to change notification settings - Fork 58
Description
Ref: mono/SkiaSharp#745 (comment)
Copy of my comments from there and what i tried.
But it does have some problems, it doesn't really seem to like rendering two dock windows (AvalonDock) it gets confused.

Some elements suddenly stop showing up, swapping back and forth when zooming.
When I hide my grid element (basically just rendering a bunch of lines) it partially comes back, but other things bug out.
Definitely related to GL, if I swap back to SKElement it renders normally again.
I'm using one SKGLWpfControl per window, and it messes up pretty badly.
If I use SKElement for both it works fine.
Hacky workaround, use SKGLWpfControl for the first Map window, and SKElement for all further created Map windows.
https://github.com/WolfCorps/TacControl/blob/bba4d364548fc18a29d29b2138a8e44de619f7d2/src/DesktopClient/Misc/MapControl.cs#L547-L559
Works nicely too, but of course is missing the performance improvement on the second window.
WolfCorps/TacControl@a90164a
Here is my code, didn't make any changes to SKGLWpfControl itself. I assume the issue is inside OpenTK.GLWpfControl
Edit: I thought this might be the problem.
GLWpfControl/src/GLWpfControl/DXGLContext.cs
Line 115 in 0e657c1
| var window = Window.GetWindow(depObject); |
It shares the same context, for both windows, which it seems like it shouldn't.
But even using
mainSettings.ContextToUse to select seperate context for both windows, doesn't help.
Changing the code to manually get the correct window handle via Application.Current.Windows, also not better.
Two contexts in two seperate windows will confuse eachother.
Out of ideas at this point, but I also don't really know GL nor any of this code.
I don't have time currently to make a simpler repro, without maybe SkiaSharp/Mapsui/AvalonDock.