[Interest] Qt/D3D integration through ANGLE PBuffer
Thomas Sevaldrud
thomas at silentwings.no
Thu Sep 24 16:15:42 CEST 2015
This is great, thanks for very useful info!
I'm not sure I understood Andew's part about rendering the Quick Scene
graph, or I may have been a bit unclear when describing the problem.
Basically I want to render a Qt Quick scene graph and some custom OpenGL
graphics into a Direct3D control (D3DImage in WPF). What Andew suggests
would be the other way around I think? I.e use a D3D texture in the scene
graph? Or did I misunderstand?
As Laszlo suggests I'll try using QQuickRenderControl to render my scene
into the PBuffer/D3D texture, but I must admit I am a bit confused as to
how this works too. For instance I'm not sure I understand how to set up
the QML Engine so that it is associated with the QQuickRenderControl. In
the QuickRenderControl example from Qt 5.5 it appears that they set up the
QML Engine in a QQuickWindow with an FBO as render target. In my case I
need the EGL PBuffer as render target. How would I go about doing that?
- Thomas
On Thu, Sep 24, 2015 at 2:48 PM, Andrew Knight <andrew.knight at intopalo.com>
wrote:
> Hi Thomas,
>
> On 09/24/2015 03:11 PM, Thomas Sevaldrud wrote:
>
>> Hi,
>>
>> I have earlier made an implementation of Qt/D3D integration by hacking
>> into the ANGLE D3D SwapChain and extracting the D3DSurface directly there.
>>
>> However, this is a bit flakey, and I have had to change this code several
>> times when new versions of Qt and ANGLE are released.
>>
>> So, now I want to do this the supported way through the
>> EGL_ANGLE_surface_d3d_texture_2d_share_handle extension. If I understand
>> this correctly I can set up a PBuffer-based render target which I can query
>> for a D3D texture sharing handle using the eglQuerySurfacePointerANGLE
>> extension.
>>
>
> Yes, this is possible.
>
> Now, before I start coding, I wonder if anyone has an example of using
>> this extension for rendering to a D3D Texture? Someone mentioned on the
>> list earlier that there should be an example of this in QtMultimedia, but I
>> haven't been able to find it.
>>
>
> The two places this extension is used are at:
> (D3D11)
> http://code.qt.io/cgit/qt/qtmultimedia.git/tree/src/plugins/winrt/qwinrtabstractvideorenderercontrol.cpp#n372
>
> This one creates a shared texture using D3D and shares it with ANGLE. This
> texture is updated when a video player or camera queues a frame. It is
> bound to the pipeline with a QOpenGLTexture object and eglBindTexImage().
>
> (D3D9)
>
> http://code.qt.io/cgit/qt/qtmultimedia.git/tree/src/plugins/wmf/evrd3dpresentengine.cpp#n451
>
> This one first creates a pbuffer using EGL, gets the shared texture handle
> from it, and then opens up the texture in D3D.
>
> Both cases are therefore covered, as well as both major D3D versions.
>
> Also, for the PBuffer implementation, should I create a PBuffer directly
>> through EGL, or can I use QOffsceenSurface? If I understand correctly,
>> QOffscreenSurface will be implemented with a PBuffer on Windows?
>> To complicate matters even more I want to include a Quick scene graph in
>> this as well, but I suppose I can use the new QQuickRenderControl class for
>> this when I have the PBuffer render target sorted out?
>>
>
> I would just render to your D3D texture (by creating it via one of the
> ways described above) and use it in the scene graph by binding its content
> to the currently bound QOpenGLTexture object with eglBindTexImage(). You
> can create a QSGTexture from a QOpenGLTexture by passing the texture id to
> QSGEngine::createTextureFromId().
>
> Best regards,
>> Thomas
>>
>>
>> _______________________________________________
>> 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/20150924/2d671ad3/attachment.html>
More information about the Interest
mailing list