Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Qt and DirectX
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Qt and DirectX

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 5.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    apap_
    wrote on 10 Sept 2014, 13:43 last edited by
    #1

    Hi,

    I am using Qt 5.2.1 Windows ANGLE build and I would like to retrieve underlying DirectX informations.
    I have a GLWidget in which I do some OpenGL stuff and I want to get pointers to DirectX textures, swapchain, contexts that are instantiated by Qt (or more exactly by ANGLE).
    Is it possible from Qt ?

    1 Reply Last reply
    0
    • P Offline
      P Offline
      primem0ver
      wrote on 10 Sept 2014, 14:02 last edited by
      #2

      I am not familiar with ANGLE but I have looked up doing something similar using a graphics engine that can make use of DirectX so I can give you a basic answer.

      You can't do this from Qt directly but you can incorporate DirectX into a Qt application. You can even host a direct X drawing surface inside a Qt widget. You just have to realize that Qt won't be able to access DirectX for you. You must create the interface yourself and link the drawing surface to the Qt widget's handle.

      You can find examples of this and similar tasks around the internet. "Here":https://code.google.com/p/qtdxsample/ is one example to give you a head start.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        apap_
        wrote on 11 Sept 2014, 08:37 last edited by
        #3

        Thanks for your answer but that's not exactly what I search.
        I don't want to do DirectX stuff, I just want to retrieve DirectX resources instantiated by Qt/ANGLE.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          JKSH
          Moderators
          wrote on 11 Sept 2014, 09:00 last edited by
          #4

          Hi,

          [quote author="apap_" date="1410424647"]I don't want to do DirectX stuff, I just want to retrieve DirectX resources instantiated by Qt/ANGLE.
          [/quote]That's not possible unfortunately. ANGLE does not expose any DirectX resources -- it only provides an implementation for pure OpenGL API.

          What do you want to do with the DirectX resources?

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          0
          • A Offline
            A Offline
            apap_
            wrote on 11 Sept 2014, 19:48 last edited by
            #5

            I need to provide these resources to Oculus SDK which do some stuff on texture before displaying it (lens distortion, correction of chromatic aberration, ...).

            There something that I do not understand, when does ANGLE wraps OpenGL calls to DirectX ? I did not find any direct call to ANGLE API from Qt source code.
            Qt ANGLE is based on D3D9 right ? Is it possible to wrap to D3D11 ?

            After looking to ANGLE source code in Qt sources, I find private members which hold the needed resources (swapchain, device, texture, ...), should it possible to patch Qt ANGLE to have these resources exposed public ?

            1 Reply Last reply
            0
            • J Offline
              J Offline
              JKSH
              Moderators
              wrote on 12 Sept 2014, 02:31 last edited by
              #6

              [quote author="apap_" date="1410464937"]I need to provide these resources to Oculus SDK which do some stuff on texture before displaying it (lens distortion, correction of chromatic aberration, ...).[/quote]Neat!

              [quote author="apap_" date="1410464937"]There something that I do not understand, when does ANGLE wraps OpenGL calls to DirectX ? I did not find any direct call to ANGLE API from Qt source code.[/quote]ANGLE API = OpenGL functions

              ANGLE does not provide its own API. It is an implementation of the OpenGL API. This implementation calls DirectX functions, which then interact with the GPU.

              Similarly, graphics card vendors also provide their own implementation of OpenGL that are optimized for their GPUs. These implementations become available on your PC when you install your graphics drivers (e.g. AMD drivers or Nvidia drivers). These implementations interact directly with the GPU.

              Qt code simply calls OpenGL functions. It doesn't care who provides the implementation.


              To think about it a different way, these headers form the ANGLE API: https://qt.gitorious.org/qt/qtbase/source/src/3rdparty/angle/include (notice that they are OpenGL functions that are called by Qt)

              [quote author="apap_" date="1410464937"]Qt ANGLE is based on D3D9 right ? Is it possible to wrap to D3D11 ?[/quote]For the upcoming Qt 5.4.0 release, you don't need to do anything special. ANGLE will use D3D11 by default. If the GPU doesn't support D3D11, ANGLE will automatically fall back to D3D9.

              For Qt 5.3 and earlier, use the following option when you configure Qt (you will need to build Qt yourself):
              @-angle-d3d11@

              (If you're interested, here is the patch which made D3D11 default: https://codereview.qt-project.org/#/c/93618/ The commit message contains an explanation.)

              [quote author="apap_" date="1410464937"]After looking to ANGLE source code in Qt sources, I find private members which hold the needed resources (swapchain, device, texture, ...), should it possible to patch Qt ANGLE to have these resources exposed public ?[/quote]It should be possible, in theory. You will have to patch and build ANGLE yourself.

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              1 Reply Last reply
              0
              • A Offline
                A Offline
                apap_
                wrote on 12 Sept 2014, 11:27 last edited by
                #7

                Ok thanks for answering, your explanation is very useful !
                Regards

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  JKSH
                  Moderators
                  wrote on 14 Sept 2014, 00:26 last edited by
                  #8

                  You're welcome. Good luck with your project!

                  If your questions have been resolved, please edit your original post to add "[SOLVED]" to the title.

                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                  1 Reply Last reply
                  0

                  2/8

                  10 Sept 2014, 14:02

                  topic:navigator.unread, 6
                  • Login

                  • Login or register to search.
                  2 out of 8
                  • First post
                    2/8
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved