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. Creating Custom Widget Surfaces
Forum Updated to NodeBB v4.3 + New Features

Creating Custom Widget Surfaces

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 1.8k Views 2 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.
  • S Offline
    S Offline
    Samuel Ives
    wrote on 29 May 2018, 11:30 last edited by
    #1

    I do not have much experience with the Qi graphical api and I did not like it much and I found it badly documented, I would like to create a widget of DirectX, OpenGL, Vulkan or any other graphic API. For example in vex of using QOpenGLWidget to create a widget using external libraries like glew, SDL or glut, all natively with C ++ instead of QML, I know this is possible as for example this person created their own "widget" of Vulkan.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 29 May 2018, 20:56 last edited by
      #2

      Hi and welcome to devnet,

      OpenGL has been supported by Qt way before QML existed.

      Qt also has now support for Vulkan. You have an example here in the documentation. However you have some work to do as described here.

      On that same page, you have the starting point of Qt's OpenGL support. You don't need glew, SDL nor glut.
      There are some simple OpenGL related samples.

      So what is it exactly that you are trying to do ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      S 1 Reply Last reply 30 May 2018, 00:15
      0
      • S SGaist
        29 May 2018, 20:56

        Hi and welcome to devnet,

        OpenGL has been supported by Qt way before QML existed.

        Qt also has now support for Vulkan. You have an example here in the documentation. However you have some work to do as described here.

        On that same page, you have the starting point of Qt's OpenGL support. You don't need glew, SDL nor glut.
        There are some simple OpenGL related samples.

        So what is it exactly that you are trying to do ?

        S Offline
        S Offline
        Samuel Ives
        wrote on 30 May 2018, 00:15 last edited by
        #3

        @SGaist One of my main reasons why I want to make an abstract rendering widget to facilitate the deployment of directx, vulkan and opengl, why in the future I intend to build a level editor with qt but with the rendering system that is independent of the libraries of qt. Another reason I want to build a custom widget is ANGLE, so I read OpenGl is rendered by ANGLE and sometimes it converts to directx (I did not understand what the documentation meant by that). I know there must be some way to even why the Cry Engine editor is done with Qt.

        W 1 Reply Last reply 30 May 2018, 23:07
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 30 May 2018, 21:37 last edited by
          #4

          Are you aware of the Qt3D module ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          S 1 Reply Last reply 30 May 2018, 22:44
          0
          • S SGaist
            30 May 2018, 21:37

            Are you aware of the Qt3D module ?

            S Offline
            S Offline
            Samuel Ives
            wrote on 30 May 2018, 22:44 last edited by
            #5

            @SGaist As I have already said in the above comment I need the qt just for the level editor, the renderer I will do independent of the qt libraries but if it is not possible to create a similar widget I should just look for other ways to build an editor.

            1 Reply Last reply
            0
            • S Samuel Ives
              30 May 2018, 00:15

              @SGaist One of my main reasons why I want to make an abstract rendering widget to facilitate the deployment of directx, vulkan and opengl, why in the future I intend to build a level editor with qt but with the rendering system that is independent of the libraries of qt. Another reason I want to build a custom widget is ANGLE, so I read OpenGl is rendered by ANGLE and sometimes it converts to directx (I did not understand what the documentation meant by that). I know there must be some way to even why the Cry Engine editor is done with Qt.

              W Offline
              W Offline
              wrosecrans
              wrote on 30 May 2018, 23:07 last edited by wrosecrans
              #6

              @Samuel-Ives If you make a QOpenGLWidget, you can draw into it however you want. It just sets up the surface and context, and calls a function that you implement to handle the drawing. So you can make your graphics engine that does OpenGL drawing into a library, and make it responsible for doing the drawing into that widget. Then you build a Qt GUI around it with all the buttons and knobs that you want. To make your game/app/whatever then you just need to make your own main() that sets up an OpenGL context without Qt and you can call the same Qt-free graphics engine code in your library. You can use a standalone QWindow instead of a QWidget if you don't want to make that view a widget in a layout.

              For DirectX, it's more complicated. I am not a Windows guy, so I have never tried it. But you can get a native window handle and then setup contexts or whatever it uses as a normal Win32 window handle and basically do the same thing.

              Vulkan support is pretty new, so it's not as mature as OpenGL, but there is a standard QVulkanWindow class you can use in your editor to give your engine code a place to draw.

              If you can clarify what exactly you want to do, and what problems you are running into doing it, people can offer more specific advice.

              S 1 Reply Last reply 31 May 2018, 00:50
              1
              • W wrosecrans
                30 May 2018, 23:07

                @Samuel-Ives If you make a QOpenGLWidget, you can draw into it however you want. It just sets up the surface and context, and calls a function that you implement to handle the drawing. So you can make your graphics engine that does OpenGL drawing into a library, and make it responsible for doing the drawing into that widget. Then you build a Qt GUI around it with all the buttons and knobs that you want. To make your game/app/whatever then you just need to make your own main() that sets up an OpenGL context without Qt and you can call the same Qt-free graphics engine code in your library. You can use a standalone QWindow instead of a QWidget if you don't want to make that view a widget in a layout.

                For DirectX, it's more complicated. I am not a Windows guy, so I have never tried it. But you can get a native window handle and then setup contexts or whatever it uses as a normal Win32 window handle and basically do the same thing.

                Vulkan support is pretty new, so it's not as mature as OpenGL, but there is a standard QVulkanWindow class you can use in your editor to give your engine code a place to draw.

                If you can clarify what exactly you want to do, and what problems you are running into doing it, people can offer more specific advice.

                S Offline
                S Offline
                Samuel Ives
                wrote on 31 May 2018, 00:50 last edited by
                #7

                @wrosecrans Probably derived from a QWindow would be better, I could make an abstract QWindow class to represent the rendering "widget", then implement a class that represents the renderer with the api chosen by the user, then (In the windows environment) I should probably get the GDI and its handlers from that QWindow and use it to create the context and somehow paint on the surface of QWindow

                1 Reply Last reply
                0

                1/7

                29 May 2018, 11:30

                • Login

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