Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How can QOpenGLWidget be used in QML/QQuickView?
Forum Updated to NodeBB v4.3 + New Features

How can QOpenGLWidget be used in QML/QQuickView?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
12 Posts 5 Posters 2.2k 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.
  • M Offline
    M Offline
    mirro
    wrote on last edited by
    #1
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You might want to put some more information in your post.

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

      M 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        You might want to put some more information in your post.

        M Offline
        M Offline
        mirro
        wrote on last edited by mirro
        #3

        @SGaist
        Is there any way to import into QML/QQuickView for use?

        Is it ok to qmlRegisterType this QOpenglWidget and import it into QML?

        mrjjM 1 Reply Last reply
        0
        • M mirro

          @SGaist
          Is there any way to import into QML/QQuickView for use?

          Is it ok to qmlRegisterType this QOpenglWidget and import it into QML?

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @mirro
          Hi
          Ehh
          QQuickWidget or QOpenglWidget is used to have QML/openGl in QWidget app.

          QML already uses openGL and QQuickWidget would be pointless since its already QML
          so can you please explain what you want from this ?

          M 1 Reply Last reply
          0
          • mrjjM mrjj

            @mirro
            Hi
            Ehh
            QQuickWidget or QOpenglWidget is used to have QML/openGl in QWidget app.

            QML already uses openGL and QQuickWidget would be pointless since its already QML
            so can you please explain what you want from this ?

            M Offline
            M Offline
            mirro
            wrote on last edited by
            #5

            @mrjj
            My plan is that QOpenGLWidget will integrate OSG and then import QOpenGLWidget into QML for display...

            Is it ok to qmlRegisterType this QOpenglWidget and import it into QML?

            mrjjM 1 Reply Last reply
            0
            • M mirro

              @mrjj
              My plan is that QOpenGLWidget will integrate OSG and then import QOpenGLWidget into QML for display...

              Is it ok to qmlRegisterType this QOpenglWidget and import it into QML?

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi
              Im not sure that will work but just try it :)
              It can maximum crash hard.

              But i think something like this is a better way
              https://forum.qt.io/topic/30707/demo-integrating-openscenegraph-with-qt-quick

              M 1 Reply Last reply
              0
              • mrjjM mrjj

                Hi
                Im not sure that will work but just try it :)
                It can maximum crash hard.

                But i think something like this is a better way
                https://forum.qt.io/topic/30707/demo-integrating-openscenegraph-with-qt-quick

                M Offline
                M Offline
                mirro
                wrote on last edited by mirro
                #7

                @mrjj osgQtQuick 2.0
                I find osgQtQuick 2.0 to be relatively crude compared to osgQT for QOpenglWidget...

                https://github.com/openscenegraph/osgQt

                Is there another way to import QOpengLWidgets into QML display?

                mrjjM 1 Reply Last reply
                0
                • M mirro

                  @mrjj osgQtQuick 2.0
                  I find osgQtQuick 2.0 to be relatively crude compared to osgQT for QOpenglWidget...

                  https://github.com/openscenegraph/osgQt

                  Is there another way to import QOpengLWidgets into QML display?

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @mirro said in How can QOpenGLWidget be used in QML/QQuickView?:

                  Is there another way to import QOpengLWidgets into QML display?

                  I don't know if it will work as QML scenegraph might not support it.

                  But just try it.
                  https://forum.qt.io/topic/63057/using-a-qt-5-widget-within-a-qml-application

                  and see if it will render as it should.

                  It if doesnt work, it will most likely just render black or simuliar so i would just test it out.
                  And please report back if it works or not :=)

                  M 1 Reply Last reply
                  0
                  • mrjjM mrjj

                    @mirro said in How can QOpenGLWidget be used in QML/QQuickView?:

                    Is there another way to import QOpengLWidgets into QML display?

                    I don't know if it will work as QML scenegraph might not support it.

                    But just try it.
                    https://forum.qt.io/topic/63057/using-a-qt-5-widget-within-a-qml-application

                    and see if it will render as it should.

                    It if doesnt work, it will most likely just render black or simuliar so i would just test it out.
                    And please report back if it works or not :=)

                    M Offline
                    M Offline
                    mirro
                    wrote on last edited by mirro
                    #9

                    @mrjj
                    https://forum.qt.io/topic/63057/using-a-qt-5-widget-within-a-qml-application/4
                    I tested it and it doesn't work. It is possible that the initialization rendering mechanism is inconsistent.

                    QOpenGLWidget rendering mechanism is the same as QML, I don't know why QOpenGLWidget can't be embedded in QML.

                    mrjjM 1 Reply Last reply
                    0
                    • M mirro

                      @mrjj
                      https://forum.qt.io/topic/63057/using-a-qt-5-widget-within-a-qml-application/4
                      I tested it and it doesn't work. It is possible that the initialization rendering mechanism is inconsistent.

                      QOpenGLWidget rendering mechanism is the same as QML, I don't know why QOpenGLWidget can't be embedded in QML.

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @mirro

                      Ok. I didn't think it would as its not designed to be used that way.
                      But we could have been lucky.

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        SamH
                        wrote on last edited by
                        #11

                        This is actually a big problem for me too.

                        "QML uses OpenGL so this would be pointless" No, it does not. It can use OpenGL, Vulkan, Software rendering, or whatever is on the system.

                        Also, the OP is clearly asking to be able to use the OpenGL functionality such as glClearColor() in a QQuickView.... not just the standard 2d QPainter.

                        I have been trying the QSGRenderNode option. It is great if you just want to do whatever is in the Qt examples.... but say you wanted to use a 3rd party renderer, which requires some initialization with a valid OpenGL context BEFORE instantiating the quickview and SHARING this context with other views? then you are out of luck.

                        It seems to me the only option to get this 3rd party rendering working so far is in a QOpenglWidget, and sharing that widget's context to another...

                        But to do this in QML? Please can someone explain?

                        A bit rubbish if you can only do advanced opengl stuff in a widgets style application....

                        johngodJ 1 Reply Last reply
                        0
                        • S SamH

                          This is actually a big problem for me too.

                          "QML uses OpenGL so this would be pointless" No, it does not. It can use OpenGL, Vulkan, Software rendering, or whatever is on the system.

                          Also, the OP is clearly asking to be able to use the OpenGL functionality such as glClearColor() in a QQuickView.... not just the standard 2d QPainter.

                          I have been trying the QSGRenderNode option. It is great if you just want to do whatever is in the Qt examples.... but say you wanted to use a 3rd party renderer, which requires some initialization with a valid OpenGL context BEFORE instantiating the quickview and SHARING this context with other views? then you are out of luck.

                          It seems to me the only option to get this 3rd party rendering working so far is in a QOpenglWidget, and sharing that widget's context to another...

                          But to do this in QML? Please can someone explain?

                          A bit rubbish if you can only do advanced opengl stuff in a widgets style application....

                          johngodJ Offline
                          johngodJ Offline
                          johngod
                          wrote on last edited by
                          #12

                          @SamH
                          Not sure if this will help https://www.youtube.com/watch?v=FamAKvkfzxM I have not seen all of the video, but maybe thats what your looking for ? Personally I did OpenGL stuff in qml doing the Scene Graph - OpenGL Under QML example approach, but I was not using third party rendering. Also it was a bit of a paint having to split all the logic between a object and object rendered, a bit quirky to say the least. Now I am done with OpenGL. Vulkan, and Metal have appeard, Apple is deprecating Opengl, so I'm migrating all my stuff to Quick3D, I find it a joy to use, and it is powerfull enought, I can use shaders and all that stuff

                          1 Reply Last reply
                          0

                          • Login

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