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++:
qmlRegisterType<Squircle>("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