[Interest] Qt/ANGLE .NET integration stopped working between Qt 5.3 and 5.4

Sean Harmer sh at theharmers.co.uk
Tue Sep 8 19:41:44 CEST 2015


Probably as a result of moving to dynamic GL builds rather than ones 
hard linked against opengl32.dll or gles2.dll/libEGL etc.

Cheers,

Sean

On 08/09/2015 12:52, Eirik Ulvik wrote:
> Thanks for the reply Andrew.
> Seems that the problem was quite a dumb one. In 5.3 we did not need to 
> link against libEGL with our current project setup in Qt Creator. This 
> changed in 5.4 for some reason we do not quite understand. The problem 
> was that we were linking against a different libEGL than Qt loads thus 
> the calls failed. I would have expected the calls to fail in a more 
> spectacular way, eg. segfault, but this did not happen and it tricked us.
>
> Regards,
> Eirik Ulvik
>
> tir. 8. sep. 2015 kl. 09.01 skrev Andrew Knight 
> <andrew.knight at intopalo.com <mailto:andrew.knight at intopalo.com>>:
>
>     Hi Eirik,
>
>     On 09/07/2015 11:06 PM, Eirik Ulvik wrote:
>      > We have an integration between Qt/OpenGL using QML and .NET/WPF
>     that
>     worked fine in Qt 5.3.
>      > The integration is based on a question asked on this mailing list
>     before:
>     http://lists.qt-project.org/pipermail/interest/2014-January/010827.html
>     and depends the fact that Qt uses ANGLE as the backend renderer.
>      >
>      > In order to show a OpenGL based rendering from Qt/C++ code in a
>     .NET
>     based WPF application we need to get the DirectX buffer pointer.
>     It is a
>     requirement that the backend rendering system is DirectX 9. I have
>     managed to force Qt to use ANGLE with a DirectX 9 backend. The output
>     from the QML scene graph and qt.qpa.gl <http://qt.qpa.gl>
>     <http://qt.qpa.gl/> logger:
>      >
>     *snip*
>      >
>      > System info:
>      > Windows 10
>      > Installed Qt 5.4 using Visual Studio 2013 compiler.
>      >
>      > The code that used to work before is this, but now always fails:
>      >
>      > #include <d3d9.h>
>      > #include <dxgi.h>
>      > #include <libEGL/Surface.h>
>      > #if QT_VERSION >= 0x050400
>      >     #include <libGLESv2/renderer/d3d/d3d9/SwapChain9.h>
>      > #elif QT_VERSION >= 0x050300
>      >     #include <libGLESv2/renderer/d3d9/SwapChain9.h>
>      > #else
>      >     #include <libGLESv2/renderer/SwapChain9.h>
>      > #endif
>      > #include <EGL/egl.h>
>      > #include <EGL/eglext.h>
>      >
>      > IDirect3DSurface9* AngleQmlRenderSurface::getD3DSurfaceHandle()
>      > {
>      >     //Works in Qt 5.3, always NULL in Qt 5.4
>      >     EGLDisplay display = eglGetCurrentDisplay();
>      >     EGLBoolean result = eglSwapInterval(display, 0);
>      >
>      >     //Works in Qt 5.3, always NULL in Qt 5.4
>      >     EGLSurface sfc = eglGetCurrentSurface(EGL_DRAW);
>      >     egl::Surface* surface = static_cast<egl::Surface*>(sfc);
>      >     rx::SwapChain *swapChain = surface->getSwapChain();
>      >     rx::SwapChain9* swapChainD3D9 =
>     dynamic_cast<rx::SwapChain9*>(swapChain);
>      >
>      >     return swapChainD3D9->getRenderTarget();
>      > }
>      >
>      > Any suggestion to what might be the problem is much appreciated.
>
>     You are using private API from ANGLE to get the pointer, so there
>     are no
>     guarantees that this behavior is stable. Have you debugged into
>     this to
>     see what's going on there? What is NULL anyway - the render
>     target, swap
>     chain, or surface?
>
>     Have you considered changing your rendering strategy? There are other
>     ways to do D3D/OpenGL interop. ANGLE provides
>     eglCreatePbufferFromClientBuffer with
>     EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE
>     (https://www.khronos.org/registry/egl/extensions/ANGLE/EGL_ANGLE_surface_d3d_texture_2d_share_handle.txt),
>     which allows you to pass a D3D texture to ANGLE for use as a texture
>     e.g. within the Scene Graph. There are examples of its usage inside
>     QtMultimedia.
>
>      >
>      > Best regards,
>      > Eirik Ulvik
>      >
>
>     HTH,
>     Andrew
>
>     _______________________________________________
>     Interest mailing list
>     Interest at qt-project.org <mailto:Interest at qt-project.org>
>     http://lists.qt-project.org/mailman/listinfo/interest
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150908/0c66fa03/attachment.html>


More information about the Interest mailing list