Open dbruning opened 1 year ago
Hello @dbruning In the capture method, I transfer the buffer generated by MonoGame to the Avalonia image. This is execute very fast, but I would like to find a better solution like a texture in GL surface to avoid capture.
if you want to share the buffer w GL these might show how to do that: let me know if you try it im ok with current one.. I only use one tab and I use Avalonia Dock which is a bit rough..
https://github.com/SamboyCoding/OpenTKAvalonia https://github.com/AvaloniaUI/Avalonia/blob/7842883961d094e08e9def7f30cf32fd573179c7/samples/ControlCatalog/Pages/OpenGlPage.xaml.cs
for me copy is ok. net 8 has a SIMD autovectorized copy. It should not be a big deal. threading not graphics and using a lockless producer consumer pattern can keep the UI thread free, drawing last finished frame while cpu draws the next. can greatly improve performance ,.. usually you copy the model though.
also might want to set your timerResoution less than 16 ms,. might speed up things and let you smooth framerates. i set it to 4.. on on windows, other ways on linux. mac
public static class WinApi
{
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Interoperability",
"CA1401:PInvokesShouldNotBeVisible"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage"), SuppressUnmanagedCodeSecurity] [DllImport("winmm.dll", EntryPoint="timeBeginPeriod", SetLastError=true)]
public static extern uint TimeBeginPeriod(uint uMilliseconds);
/// <summary>TimeEndPeriod(). See the Windows API documentation
for details.
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Interoperability",
"CA1401:PInvokesShouldNotBeVisible"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage"), SuppressUnmanagedCodeSecurity] [DllImport("winmm.dll", EntryPoint="timeEndPeriod", SetLastError=true)]
public static extern uint TimeEndPeriod(uint uMilliseconds);
}
On Wed, Jul 19, 2023 at 10:07 AM Omid Mafakher @.***> wrote:
Hello @dbruning https://github.com/dbruning In the capture method, I transfer the buffer generated by MonoGame to the Avalonia image. This is execute very fast, but I would like to find a better solution like a texture in GL surface to avoid capture.
— Reply to this email directly, view it on GitHub https://github.com/AvaloniaInside/AvaloniaInside.MonoGame/issues/5#issuecomment-1642368962, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD74XGIBT63CYIDRUXXOTCTXRAA4PANCNFSM6AAAAAA2PCSB7E . You are receiving this because you are subscribed to this thread.Message ID: @.*** com>
Thankyou for this info - it's enough to give me confidence to try this out in an upcoming project.
a guru kekekek has done this with directX aslo, and Stride may have, using Silk bindings. also kekekek has used it in shipping tools. with DirectX also, .if you search hes commits, i might try it using OpenTK, you can put avaloni in that or OpenTK in avalonia i think. so you can have in game UI and around game IDE.
i want to use https://github.com/wieslawsoltes/Dock
but he has many projects going and deep into AI also. the ap can work your API as well. and has voice input now.
i recommend this over Dirksters one but he's tooling w ai.. and over stretched this guru and i did get it working a while ago when I hit his sponsor with 20$ he solved an issue i spend over a week on.. I suggest dont hack if you have windowing UI thread problems, find a guru they can fix something for just 20$ save you hours.
Avalonia . its in React or XAML.. but clearly WPF core isnt great , being windows only ..
Another idea for mobile , mac, Windows (no linux) is to use the UI of the OS.. and that would be Maui.. only for mobile.. Avalonaui, and others reader using their on system UI and doesn't give you the consistency..say for input, text, an fonts, and such
Say you want a text input on just Android or Ios.. and it you need that game engine embedded i think it can be done..
https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Controls/Platform/ITopLevelImpl.cs
just in general on tooling and domain specific UI:
if you get anything work of find something better supported, please share because they all need sponsors i spent weeks.. a few months ago finding the best way to tool around game engines .. ImgUI tessellated teh text and its popular but i dont want to use c++ or to that.
i wont use a proprietary because they go under and don't open the source code. Docking is essential to work without two monitors.
also tooling, scripting , CS-Script , notepad++, and VSCode.. all have new features and there GPT/Voice tooling coming iin and its got domain specific features, on teh horizon.
. UI should be just a mic.. + other options, there there but voice useable.. adn microsoft is working on this.. i hope they dont screw it up .. i been pushing for it so tired of typing and clicking.. this is Windows Copilot for insiders, and its currently a mess i wont install it yet... so im trying to pushed them to use the API and object model to voice input.. the star trek like human to computer future is finally arriving but is still all early adopting hell.
hard to make choice, im just throw out what i ve looked at, i have to get back to it soon,. so sidetracked on the chatbots because they are getting good as UI and as coders and api users..
I would recommend looking into new GPU Interop APIs available from 11.0 release - https://github.com/AvaloniaUI/Avalonia/issues/9925
OpenGlControlBase, for example, is implemented on top of these APIs, but tied to the OpenGL. If MonoGame allows providing custom surface targets to render via different graphical APIs (opengl, directx, metal, vulkan...), it should be the best way to integrate frameworks without using OS surface APIs.
Hello, OK @maxkatz6 I will see if I can integrate Mono Game using a custom surface.
Hi there,
Could you please provide a little more information on the known issue "Not a good performance for the moment."? What are the problems with performance & do you think they can be fixed with more work?
Thanks!