Important: Please read the Qt Code of Conduct -

Qt and DirectX 9

  • I'm sure its been asked before but I cannot find a direct answer. I want to use Qt with DirectX 9 to create a GUI based DirectX application. Does Qt have support for DirectX 9.0c?

  • Moderators

    As far as I know, this can be done.

    Qt itself, of course, uses OpenGL and if you decide to go with DX, you will loose the cross-platform support.

  • Moderators

    Depending on what kind of support you have in mind the answer is either yes or no.
    Qt can provide you with a native handle to the window. With that you can create whichever DirectX version context you need and draw there whatever you want. That's a bout it. There are no helpers classes or functions etc. Qt itself knows nothing about DirectX.

  • Like Chris mentioned. Include directx in your project, qt can return back to you HWND (windows native handle) , and then use directx calls and provide windows handle to directx funtions ... that's it ..pretty straight.

  • When using the Angle builds of Qt (not the native OpenGL ones), you could, in theory, mix Qt content with other Direct3D stuff by pulling out the D3D handle Angle uses via EGL_ANGLE_surface_d3d_texture_2d_share_handle. Or, if the goal is to have some D3D rendering as part of the Qt content, EGL_ANGLE_d3d_share_handle_client_buffer could be used to create an EGL pbuffer from a D3D texture. The pbuffer can then be used as a texture, allowing the D3D rendering to be shown in a Qt Quick scene etc.

  • Moderators

    @agocs - though this might work, having a dependency on both ANGLE and OpenGL (for the extension mechanism) just to get a D3D handle seems like an overkill. This might be a better solution if you needed to mix OpenGL and D3D, though I can't imagine why someone would want to.

Log in to reply