Replies: 2 comments 1 reply
-
Then you need to use our graphics interop APIs. Please, check GpuInterop demo and see how to set up GPU surface sharing. |
Beta Was this translation helpful? Give feedback.
-
What is the proposed way to do this? Is it meant to use a library like Silk.net that creates a openGl context that will then be shared via the GPU interop api or it is similar to the approach in the OpenGLControlBaseResources file? I am using the DrawSurfaceBaseDemo from the GPUInterop Demo as a foundation to create my visual. However, when trying to create a shared context I am getting an error message that says that a egl context is already present ( "EGL context already present?"). See a sample of my intializeGraphicRessources method below. Also when creating a shared context I would get an instance of the IGLContext. Any way on how to get the IntPtr to the context or is it really necessary to use a 3rd party library that creates the openGL context? I was looking into the samples using directX and Vulkan but do not really get how to transport it to OpenGL. Any examples or guidelines would be really helpful here. The DrawingSurfaceDemoBase is designed to import a pre-rendered GPU image (a texture) into the CompositionDrawingSurface. The Direct3D11 and Vulkan examples demonstrate how to create an offscreen framebuffer, render into it, and then obtain a shareable handle of the resulting texture for import via ICompositionGpuInterop.ImportImage(). How does this process work equivalently for OpenGL with ANGLE/EGL? Can anyone help me out on this one?
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am currently working on a custom control that inherits from Avalonia.OpenGL.Controls.OpenGlControlBase. My goal is to integrate a 3rd-party native graphics library that requires direct access to an active OpenGL rendering context and its associated "device context" or "drawable surface" to perform its drawing operations. This involves providing IntPtr handles to the openGl-Context and the device context.
As I understand it, on Windows, Avalonia utilizes ANGLE, which in turn leverages EGL to translate OpenGL ES calls into DirectX. On Linux, EGL (e.g., with Wayland) or GLX (with X11) would be used.
I need to obtain the native IntPtr for:
The OpenGL rendering context that OpenGlControlBase has created and manages.
The associated device context / drawable / surface handle (e.g., HDC on Windows, Drawable/EGLSurface on Linux) that the OpenGL context is bound to, and into which the 3rd-party library should draw.
For this I was trying to instanciate the EglInterface class since it contains a methode GetCurrentContext(). However the constructor excepts a string library. To get this working on Windows, I would need a dll that hosts the EGL implementation, probably something similar to libGLESv2.dll. However, in my output directory there is no such dll.
Does anybody know how I can get the native IntPtr to the created OpenGL-context for plattforms like Linux and Windows?
Is there a way to access the native IntPtr from the OpenGLControlBase?
See attached sample from the OnOpenGlInit override for the EglInterface.
Beta Was this translation helpful? Give feedback.
All reactions