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. OpenGL and QML overlapping
QtWS25 Last Chance

OpenGL and QML overlapping

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 2 Posters 1.5k Views
  • 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
    MasterQ32
    wrote on last edited by
    #1

    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
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Hi,

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

      157

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MasterQ32
        wrote on last edited by
        #3

        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
        0
        • p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on last edited by
          #4

          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
          0
          • M Offline
            M Offline
            MasterQ32
            wrote on last edited by
            #5

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

            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