Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    OpenGL and QML overlapping

    QML and Qt Quick
    2
    5
    1294
    Loading More Posts
    • 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
      MasterQ32 last edited by

      Hello there!

      I am currently developing some tool with Qt 5.3 and QtQuick 2, trying to implement an OpenGL control.
      My template was the "Scene Graph - OpenGL Under QML":http://qt-project.org/doc/qt-5/qtquick-scenegraph-openglunderqml-example.html Example. It worked really well until i discovered a strange thing:

      Normal QML components appear to overlap any of my OpenGL drawings which is kinda obstructive if i want to contain my OpenGL rendered thing in the scene graph before other objects.

      Has anyone encountered similar behaviour and if yes, is there a fix for this?

      1 Reply Last reply Reply Quote 0
      • p3c0
        p3c0 Moderators last edited by

        Hi,

        Try to set a lower Z value to the QML components.

        157

        1 Reply Last reply Reply Quote 0
        • M
          MasterQ32 last edited by

          Hey, i just tried to lower the Z values but no success.
          Here is my QML test source and the resulting image:

          @import QtQuick 2.0
          import OpenGLUnderQML 1.0

          Item {

          width: 320
          height: 480
          Rectangle {
              z: -1
              color: Qt.rgba(1, 1, 1, 0.7)
              radius: 10
              border.width: 1
              border.color: "white"
              anchors.fill: label
              anchors.margins: -10
          }
          
          Squircle {
              z: 1
              SequentialAnimation on t {
                  NumberAnimation { to: 1; duration: 2500; easing.type: Easing.InQuad }
                  NumberAnimation { to: 0; duration: 2500; easing.type: Easing.OutQuad }
                  loops: Animation.Infinite
                  running: true
              }
          }
          
          Text {
              z: -1
              id: label
              color: "black"
              wrapMode: Text.WordWrap
              text: "The background here is a squircle rendered with raw OpenGL using the 'beforeRender()' signal in QQuickWindow. This text label and its border is rendered using QML"
              anchors.right: parent.right
              anchors.left: parent.left
              anchors.bottom: parent.bottom
              anchors.margins: 20
          }
          

          }@

          !http://ps.masterq32.de/?941(Demo Image)!

          1 Reply Last reply Reply Quote 0
          • p3c0
            p3c0 Moderators last edited by

            The first 2 paragraphs "here":http://qt-project.org/doc/qt-5/qtquick-scenegraph-openglunderqml-example.html might answer your questions.

            157

            1 Reply Last reply Reply Quote 0
            • M
              MasterQ32 last edited by

              Sometimes a good RTFM is the right hint :P
              Thanks, it should work now!

              1 Reply Last reply Reply Quote 0
              • First post
                Last post