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. [Solved]Question about the example "Scene Graph - OpenGL Under QML"

[Solved]Question about the example "Scene Graph - OpenGL Under QML"

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 1.9k 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.
  • S Offline
    S Offline
    stereomatching
    wrote on last edited by
    #1

    How could I apply the effect on a specific component?

    @
    //! [1]
    import QtQuick 2.0
    import OpenGLUnderQML 1.0

    Item {

    width: 320
    height: 480
    

    //! [1] //! [2]
    Rectangle {
    color: Qt.rgba(1, 1, 1, 0.7)
    radius: 10
    border.width: 1
    border.color: "white"
    anchors.fill: label
    anchors.margins: -10

       //apply the Squircle effect on the Rectangle rather than the root item 
       Squircle {
            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 {
        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
    }
    

    }
    //! [2]

    @
    No matter how I try, it is always render on the background but not the Rectangle

    1 Reply Last reply
    0
    • slettaS Offline
      slettaS Offline
      sletta
      wrote on last edited by
      #2

      As the documentation and the description states, the Squircle is not a part of the items rendered by the scene graph. It is using raw OpenGL combined with the QQuickWindow::beforeRendering() signal. It renders itself beneath the entire Qt Quick scene.

      If you want to integrate raw GL inside the item scene, have a look at the textureinsgnode example (for integrating raw OpenGL calls using and FBO and a texture) or customgeometry and simplematerial example (for how to create a custom scenegraph node and material.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        stereomatching
        wrote on last edited by
        #3

        bq. textureinsgnode example, customgeometry, simplematerial

        Can't find any example when I input those names in the example
        page of QtCreator, are you sure the names are correct?

        but I do found other interesting examples which may solve my problem
        "Scene Graph-Rendering"

        1 Reply Last reply
        0
        • slettaS Offline
          slettaS Offline
          sletta
          wrote on last edited by
          #4

          Have a look in the 5.1 qtdeclarative source tree:

          http://doc-snapshot.qt-project.org/qt5-stable/qtquick/scenegraph-textureinsgnode.html
          http://doc-snapshot.qt-project.org/qt5-stable/qtquick/scenegraph-customgeometry.html
          http://doc-snapshot.qt-project.org/qt5-stable/qtquick/scenegraph-simplematerial.html

          The "textureinsgnode" example was added for 5.1 but the others have been there since 5.0

          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