Re: [SailfishDevel] OpenGL Under Selica QML
Hi David, The example that I use is also QQuickItem derived. Indeed I'll take your method for placement and resizing. Also necessary for landscape/portrait changes. thanks. r wim On 01/23/2014 10:38 AM, David Greaves wrote: On 23/01/14 09:28, Wim de Vries wrote: On 01/22/2014 05:34 PM, David Greaves wrote: Fantastic - I just verified that it works here too. How are you getting the GL into the QML scene? From one of the GL examples (Squircle in c++): glViewport() determining the position (not yet QML) in Page. main c++: qmlRegisterTypeSquircle(OpenGLUnderQML, 1, 0, Squircle); QML: import OpenGLUnderQML 1.0 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 } Yep - I started there too :) I created a GLItem which allows property connections and sizing so I know where to draw in the window. I then inherit from this item and render into the viewport it sets up. I will have a look at to. This is how I map the viewport to the Item location: class GLItem : public QQuickItem, protected QOpenGLFunctions ... void GLItem::paint() { if (!m_program) { m_program = new QOpenGLShaderProgram(); connect(window()-openglContext(), SIGNAL(aboutToBeDestroyed()), this, SLOT(cleanup()), Qt::DirectConnection); initializeOpenGLFunctions(); this-prep(); // Do any one-off setup that needs the glcontext to be setup (eg the shader loading) } QRectF vpr = mapRectToScene(QRectF(0.0,0.0,width(),height())); glViewport( vpr.x(), (window()-height() -( vpr.y() + vpr.height())), vpr.width(), vpr.height()); ... David ___ SailfishOS.org Devel mailing list
Re: [SailfishDevel] OpenGL Under Selica QML
On 01/22/2014 05:34 PM, David Greaves wrote: Fantastic - I just verified that it works here too. How are you getting the GL into the QML scene? From one of the GL examples (Squircle in c++): glViewport() determining the position (not yet QML) in Page. main c++: qmlRegisterTypeSquircle(OpenGLUnderQML, 1, 0, Squircle); QML: import OpenGLUnderQML 1.0 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 } I created a GLItem which allows property connections and sizing so I know where to draw in the window. I then inherit from this item and render into the viewport it sets up. I will have a look at to. Thanks. r wim David On 22/01/14 14:30, wsvries wrote: I got it working! ApplicationWindow { _backgroundVisible : false ... } This way the ApplicationWindow (background) doesn't overpaint the OpenGL. Silica items now nicely and transparantly overlap the OpenGL. r wim wsvries schreef op 2014-01-22 14:50: Thanks, I'll stick to standard QML then. r wim David Greaves schreef op 2014-01-22 12:04: On 22/01/14 10:59, David Greaves wrote: The other option is to render to an FBO and then assign that to a QML item http://qt-project.org/doc/qt-5/qtquick-visualcanvas-scenegraph.html#mixing-scene-graph-and-opengl AFAIUI it's slightly lower performance but it does give you total control over layering your GLES window into your QML. and http://qt-project.org/doc/qt-5/qtquick-scenegraph-textureinthread-example.html ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list
Re: [SailfishDevel] OpenGL Under Selica QML
On 23/01/14 09:28, Wim de Vries wrote: On 01/22/2014 05:34 PM, David Greaves wrote: Fantastic - I just verified that it works here too. How are you getting the GL into the QML scene? From one of the GL examples (Squircle in c++): glViewport() determining the position (not yet QML) in Page. main c++: qmlRegisterTypeSquircle(OpenGLUnderQML, 1, 0, Squircle); QML: import OpenGLUnderQML 1.0 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 } Yep - I started there too :) I created a GLItem which allows property connections and sizing so I know where to draw in the window. I then inherit from this item and render into the viewport it sets up. I will have a look at to. This is how I map the viewport to the Item location: class GLItem : public QQuickItem, protected QOpenGLFunctions ... void GLItem::paint() { if (!m_program) { m_program = new QOpenGLShaderProgram(); connect(window()-openglContext(), SIGNAL(aboutToBeDestroyed()), this, SLOT(cleanup()), Qt::DirectConnection); initializeOpenGLFunctions(); this-prep(); // Do any one-off setup that needs the glcontext to be setup (eg the shader loading) } QRectF vpr = mapRectToScene(QRectF(0.0,0.0,width(),height())); glViewport( vpr.x(), (window()-height() -( vpr.y() + vpr.height())), vpr.width(), vpr.height()); ... David ___ SailfishOS.org Devel mailing list
[SailfishDevel] OpenGL Under Selica QML
Hi, Some time ago Thomas Perl was so kind to supply us with an example 'OpenGL Over QML'. It uses the afterRendering() signal. I am trying to use the beforeRendering() signal (including setClearBeforeRendering(false)), but I get no OpenGL output. It works with standard (non-Selica) QML. I have the strong feeling that this is impossible because the ApplicationWindow, Page or other Silica items do paint the whole screen, overwriting the OpenGL area. Am I right? If yes, is there a way to get around it? Basically I want the (Silica) QML painted (partly transparent) over the OpenGL. Thanks. r wim ___ SailfishOS.org Devel mailing list
Re: [SailfishDevel] OpenGL Under Selica QML
On 22/01/14 08:37, Wim de Vries wrote: Hi, Some time ago Thomas Perl was so kind to supply us with an example 'OpenGL Over QML'. It uses the afterRendering() signal. I am trying to use the beforeRendering() signal (including setClearBeforeRendering(false)), but I get no OpenGL output. It works with standard (non-Selica) QML. I have the strong feeling that this is impossible because the ApplicationWindow, Page or other Silica items do paint the whole screen, overwriting the OpenGL area. Am I right? Yes If yes, is there a way to get around it? No Basically I want the (Silica) QML painted (partly transparent) over the OpenGL. Thanks. The other option is to render to an FBO and then assign that to a QML item http://qt-project.org/doc/qt-5/qtquick-visualcanvas-scenegraph.html#mixing-scene-graph-and-opengl AFAIUI it's slightly lower performance but it does give you total control over layering your GLES window into your QML. David ___ SailfishOS.org Devel mailing list
Re: [SailfishDevel] OpenGL Under Selica QML
Thanks, I'll stick to standard QML then. r wim David Greaves schreef op 2014-01-22 12:04: On 22/01/14 10:59, David Greaves wrote: The other option is to render to an FBO and then assign that to a QML item http://qt-project.org/doc/qt-5/qtquick-visualcanvas-scenegraph.html#mixing-scene-graph-and-opengl AFAIUI it's slightly lower performance but it does give you total control over layering your GLES window into your QML. and http://qt-project.org/doc/qt-5/qtquick-scenegraph-textureinthread-example.html ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list
Re: [SailfishDevel] OpenGL Under Selica QML
I got it working! ApplicationWindow { _backgroundVisible : false ... } This way the ApplicationWindow (background) doesn't overpaint the OpenGL. Silica items now nicely and transparantly overlap the OpenGL. r wim wsvries schreef op 2014-01-22 14:50: Thanks, I'll stick to standard QML then. r wim David Greaves schreef op 2014-01-22 12:04: On 22/01/14 10:59, David Greaves wrote: The other option is to render to an FBO and then assign that to a QML item http://qt-project.org/doc/qt-5/qtquick-visualcanvas-scenegraph.html#mixing-scene-graph-and-opengl AFAIUI it's slightly lower performance but it does give you total control over layering your GLES window into your QML. and http://qt-project.org/doc/qt-5/qtquick-scenegraph-textureinthread-example.html ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list
Re: [SailfishDevel] OpenGL Under Selica QML
Fantastic - I just verified that it works here too. How are you getting the GL into the QML scene? I created a GLItem which allows property connections and sizing so I know where to draw in the window. I then inherit from this item and render into the viewport it sets up. David On 22/01/14 14:30, wsvries wrote: I got it working! ApplicationWindow { _backgroundVisible : false ... } This way the ApplicationWindow (background) doesn't overpaint the OpenGL. Silica items now nicely and transparantly overlap the OpenGL. r wim wsvries schreef op 2014-01-22 14:50: Thanks, I'll stick to standard QML then. r wim David Greaves schreef op 2014-01-22 12:04: On 22/01/14 10:59, David Greaves wrote: The other option is to render to an FBO and then assign that to a QML item http://qt-project.org/doc/qt-5/qtquick-visualcanvas-scenegraph.html#mixing-scene-graph-and-opengl AFAIUI it's slightly lower performance but it does give you total control over layering your GLES window into your QML. and http://qt-project.org/doc/qt-5/qtquick-scenegraph-textureinthread-example.html ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list