[Solved]Question about the example "Scene Graph - OpenGL Under QML"
-
wrote on 26 Jun 2013, 15:32 last edited by
How could I apply the effect on a specific component?
@
//! [1]
import QtQuick 2.0
import OpenGLUnderQML 1.0Item {
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 -
wrote on 27 Jun 2013, 08:49 last edited by
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.
-
wrote on 27 Jun 2013, 10:39 last edited by
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" -
wrote on 27 Jun 2013, 11:18 last edited by
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.htmlThe "textureinsgnode" example was added for 5.1 but the others have been there since 5.0
1/4