summaryrefslogtreecommitdiffstats
path: root/tests/manual/render-qml-to-texture
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/render-qml-to-texture')
-rw-r--r--tests/manual/render-qml-to-texture/OffscreenGui.qml132
-rw-r--r--tests/manual/render-qml-to-texture/TextRectangle.qml86
-rw-r--r--tests/manual/render-qml-to-texture/main.cpp128
-rw-r--r--tests/manual/render-qml-to-texture/planematerial.cpp119
-rw-r--r--tests/manual/render-qml-to-texture/planematerial.h59
-rw-r--r--tests/manual/render-qml-to-texture/render-qml-to-texture.pri6
-rw-r--r--tests/manual/render-qml-to-texture/render-qml-to-texture.pro21
-rw-r--r--tests/manual/render-qml-to-texture/render-qml-to-texture.qrc10
-rw-r--r--tests/manual/render-qml-to-texture/shaders/es2/texturing.frag16
-rw-r--r--tests/manual/render-qml-to-texture/shaders/es2/texturing.vert26
-rw-r--r--tests/manual/render-qml-to-texture/shaders/gl3/texturing.frag16
-rw-r--r--tests/manual/render-qml-to-texture/shaders/gl3/texturing.vert25
12 files changed, 644 insertions, 0 deletions
diff --git a/tests/manual/render-qml-to-texture/OffscreenGui.qml b/tests/manual/render-qml-to-texture/OffscreenGui.qml
new file mode 100644
index 000000000..20fb0937d
--- /dev/null
+++ b/tests/manual/render-qml-to-texture/OffscreenGui.qml
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.3
+
+Rectangle {
+ width: 1024
+ height: 1024
+ color: "white"
+
+ TextRectangle {
+ id: textRect
+ }
+
+ Rectangle {
+ id: rect
+ x: 0
+ y: 0
+ width: 200
+ height: 200
+ color: "red"
+
+ ColorAnimation {
+ target: rect
+ loops: Animation.Infinite
+ property: "color"
+ from: "blue"
+ to: "green"
+ duration: 2000
+ running: true
+ }
+ }
+
+ Rectangle {
+ id: rect2
+ width: 300
+ height: 100
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ color: "red"
+
+ ColorAnimation {
+ target: rect2
+ loops: Animation.Infinite
+ property: "color"
+ from: "red"
+ to: "white"
+ duration: 2000
+ running: true
+ }
+ }
+
+ Button {
+ id: button
+ width: 100
+ height: 80
+ anchors.top: rect.bottom
+ anchors.left: parent.left
+ text: "button"
+ scale: 2.0
+ }
+ CheckBox {
+ id: checkbox
+ width: 200
+ height: 180
+ scale: 2.0
+ text: "checkbox"
+ checked: true
+ anchors.top: parent.top
+ anchors.right: parent.right
+
+ Timer {
+ interval: 1000
+ repeat: true
+ running: true
+ onTriggered: {
+ checkbox.checked = !checkbox.checked;
+ }
+ }
+ }
+ Slider {
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ width: 400
+ value: 0.0
+ minimumValue: 0
+ maximumValue: 1
+
+ PropertyAnimation on value {
+ loops: Animation.Infinite
+ duration: 3000
+ from: 0.0
+ to: 1.0
+ running: true
+ }
+ }
+}
diff --git a/tests/manual/render-qml-to-texture/TextRectangle.qml b/tests/manual/render-qml-to-texture/TextRectangle.qml
new file mode 100644
index 000000000..b47fa965b
--- /dev/null
+++ b/tests/manual/render-qml-to-texture/TextRectangle.qml
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: rectangle
+ property string myText: "The quick brown fox jumps over the lazy dog."
+ x: 352
+ y: 272
+ width: 320
+ height: 480
+ color: "steelblue"
+
+ FontLoader { id: fixedFont; name: "Courier" }
+
+ Column {
+ anchors { fill: parent; leftMargin: 10; rightMargin: 10; topMargin: 10 }
+ spacing: 15
+
+ Text {
+ text: rectangle.myText
+ color: "lightsteelblue"
+ width: parent.width
+ wrapMode: Text.WordWrap
+ font.family: "Times"
+ font.pixelSize: 20
+ }
+ Text {
+ text: rectangle.myText
+ color: "lightsteelblue"
+ width: parent.width
+ wrapMode: Text.WordWrap
+ horizontalAlignment: Text.AlignHCenter
+ font { family: "Times"; pixelSize: 20; capitalization: Font.AllUppercase }
+ }
+ Text {
+ text: rectangle.myText
+ color: "lightsteelblue"
+ width: parent.width
+ horizontalAlignment: Text.AlignRight
+ wrapMode: Text.WordWrap
+ font { family: fixedFont.name; pixelSize: 20; weight: Font.Bold; capitalization: Font.AllLowercase }
+ }
+ Text {
+ text: rectangle.myText
+ color: "lightsteelblue"
+ width: parent.width
+ wrapMode: Text.WordWrap
+ font { family: fixedFont.name; pixelSize: 20; italic: true; capitalization: Font.SmallCaps }
+ }
+ }
+}
diff --git a/tests/manual/render-qml-to-texture/main.cpp b/tests/manual/render-qml-to-texture/main.cpp
new file mode 100644
index 000000000..2420c8560
--- /dev/null
+++ b/tests/manual/render-qml-to-texture/main.cpp
@@ -0,0 +1,128 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QAnimationDriver>
+#include <QPropertyAnimation>
+#include <QQmlComponent>
+#include <QQmlEngine>
+
+#include <Qt3DCore/QEntity>
+#include <Qt3DCore/QAspectEngine>
+#include <Qt3DCore/QTransform>
+#include <Qt3DRender/QCamera>
+
+#include <Qt3DInput/QInputAspect>
+
+#include <Qt3DRender/QRenderAspect>
+#include <Qt3DRender/QEffect>
+#include <Qt3DRender/QMaterial>
+#include <Qt3DExtras/QForwardRenderer>
+#include <Qt3DQuickScene2D/QScene2D>
+#include <Qt3DExtras/QPlaneMesh>
+#include <Qt3DRender/QTextureWrapMode>
+#include <Qt3DRender/QClearBuffers>
+#include <Qt3DRender/QTexture>
+
+#include "qt3dwindow.h"
+#include "qfirstpersoncameracontroller.h"
+#include "planematerial.h"
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ Qt3DExtras::Qt3DWindow view;
+
+ // Scene Root
+ Qt3DCore::QEntity *sceneRoot = new Qt3DCore::QEntity();
+
+ // Scene Camera
+ Qt3DRender::QCamera *basicCamera = view.camera();
+ basicCamera->setProjectionType(Qt3DRender::QCameraLens::PerspectiveProjection);
+ basicCamera->setAspectRatio(view.width() / view.height());
+ basicCamera->setUpVector(QVector3D(0.0f, 1.0f, 0.0f));
+ basicCamera->setPosition(QVector3D(0.0f, 0.0f, 6.0f));
+ basicCamera->setViewCenter(QVector3D(0.0f, 0.0f, 0.0f));
+ basicCamera->setNearPlane(0.1f);
+ basicCamera->setFarPlane(1000.0f);
+ basicCamera->setFieldOfView(45.0f);
+
+ // For camera controls
+ Qt3DExtras::QFirstPersonCameraController *camController = new Qt3DExtras::QFirstPersonCameraController(sceneRoot);
+ camController->setCamera(basicCamera);
+
+ Qt3DRender::QFrameGraphNode* frameGraphNode = view.activeFrameGraph();
+ while (frameGraphNode->childNodes().size() > 0)
+ frameGraphNode = (Qt3DRender::QFrameGraphNode*)frameGraphNode->childNodes().at(0);
+ view.defaultFrameGraph()->setClearColor(QColor::fromRgbF(1.0f, 1.0f, 1.0f));
+ Qt3DRender::Quick::QScene2D *qmlTextureRenderer = new Qt3DRender::Quick::QScene2D(frameGraphNode);
+
+ Qt3DRender::QTexture2D* offscreenTexture = new Qt3DRender::QTexture2D(qmlTextureRenderer);
+ offscreenTexture->setSize(1024, 1024);
+ offscreenTexture->setFormat(Qt3DRender::QAbstractTexture::RGBA8_UNorm);
+ offscreenTexture->setGenerateMipMaps(true);
+ offscreenTexture->setMagnificationFilter(Qt3DRender::QAbstractTexture::Linear);
+ offscreenTexture->setMinificationFilter(Qt3DRender::QAbstractTexture::Linear);
+ offscreenTexture->setWrapMode(Qt3DRender::QTextureWrapMode(Qt3DRender::QTextureWrapMode::ClampToEdge, offscreenTexture));
+
+ Qt3DRender::QRenderTargetOutput *output = new Qt3DRender::QRenderTargetOutput(qmlTextureRenderer);
+ output->setAttachmentPoint(Qt3DRender::QRenderTargetOutput::Color0);
+ output->setTexture(offscreenTexture);
+
+ qmlTextureRenderer->setOutput(output);
+ QQmlEngine engine;
+ QQmlComponent component(&engine, QUrl(QStringLiteral("qrc:/OffscreenGui.qml")));
+ qmlTextureRenderer->setItem(static_cast<QQuickItem *>(component.create()));
+
+ Qt3DCore::QEntity* planeEntity = new Qt3DCore::QEntity(sceneRoot);
+ Qt3DExtras::QPlaneMesh* planeMesh = new Qt3DExtras::QPlaneMesh(planeEntity);
+ planeMesh->setWidth(4);
+ planeMesh->setHeight(4);
+ planeEntity->addComponent(planeMesh);
+
+ PlaneMaterial* material = new PlaneMaterial(offscreenTexture, planeEntity);
+ planeEntity->addComponent(material);
+
+ Qt3DCore::QTransform* transform = new Qt3DCore::QTransform(planeEntity);
+ transform->setRotation(QQuaternion::fromAxisAndAngle(1,0,0,90));
+ planeEntity->addComponent(transform);
+
+ view.setRootEntity(sceneRoot);
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/render-qml-to-texture/planematerial.cpp b/tests/manual/render-qml-to-texture/planematerial.cpp
new file mode 100644
index 000000000..4435766bb
--- /dev/null
+++ b/tests/manual/render-qml-to-texture/planematerial.cpp
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DRender/QParameter>
+#include <Qt3DRender/QEffect>
+#include <Qt3DRender/QTechnique>
+#include <Qt3DRender/QAbstractTexture>
+#include <Qt3DRender/QShaderProgram>
+#include <Qt3DRender/QRenderPass>
+#include <Qt3DRender/QBlendEquation>
+#include <Qt3DRender/QBlendEquationArguments>
+#include <Qt3DRender/QFilterKey>
+#include <Qt3DRender/QGraphicsApiFilter>
+#include <QColor>
+#include <QVector2D>
+#include <QUrl>
+
+#include "planematerial.h"
+
+PlaneMaterial::PlaneMaterial(Qt3DRender::QAbstractTexture *texture, Qt3DCore::QNode *parent)
+ : QMaterial(parent)
+ , m_effect(new Qt3DRender::QEffect(this))
+ , m_texture(texture)
+{
+ setEffect(m_effect);
+
+ m_texCoordScaleParam = new Qt3DRender::QParameter(QStringLiteral("texCoordScale"), QVector2D(1.0f, -1.0f));
+ m_texCoordBiasParam = new Qt3DRender::QParameter(QStringLiteral("texCoordBias"), QVector2D(0.0f, 1.0f));
+ m_textureParam = new Qt3DRender::QParameter(QStringLiteral("surfaceTexture"), m_texture);
+
+ m_effect->addParameter(m_texCoordScaleParam);
+ m_effect->addParameter(m_texCoordBiasParam);
+ m_effect->addParameter(m_textureParam);
+
+ m_filter = new Qt3DRender::QFilterKey(this);
+ m_filter->setName(QStringLiteral("renderingStyle"));
+ m_filter->setValue(QStringLiteral("forward"));
+
+ m_techniqueGLES = new Qt3DRender::QTechnique(m_effect);
+ m_techniqueGL3 = new Qt3DRender::QTechnique(m_effect);
+ m_techniqueGL2 = new Qt3DRender::QTechnique(m_effect);
+
+ m_techniqueGLES->addFilterKey(m_filter);
+ m_techniqueGL3->addFilterKey(m_filter);
+ m_techniqueGL2->addFilterKey(m_filter);
+
+ m_effect->addTechnique(m_techniqueGLES);
+ m_effect->addTechnique(m_techniqueGL3);
+ m_effect->addTechnique(m_techniqueGL2);
+
+ m_programGLES = new Qt3DRender::QShaderProgram(m_effect);
+ m_programGLES->setVertexShaderCode(Qt3DRender::QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/texturing.vert"))));
+ m_programGLES->setFragmentShaderCode(Qt3DRender::QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/texturing.frag"))));
+
+ m_programGL3 = new Qt3DRender::QShaderProgram(m_effect);
+ m_programGL3->setVertexShaderCode(Qt3DRender::QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/texturing.vert"))));
+ m_programGL3->setFragmentShaderCode(Qt3DRender::QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/texturing.frag"))));
+
+ m_renderPassGLES = new Qt3DRender::QRenderPass(m_effect);
+ m_renderPassGL3 = new Qt3DRender::QRenderPass(m_effect);
+ m_renderPassGL2 = new Qt3DRender::QRenderPass(m_effect);
+
+ m_renderPassGLES->setShaderProgram(m_programGLES);
+ m_renderPassGL3->setShaderProgram(m_programGL3);
+ m_renderPassGL2->setShaderProgram(m_programGL3);
+
+ m_techniqueGL2->addRenderPass(m_renderPassGL2);
+ m_techniqueGLES->addRenderPass(m_renderPassGLES);
+ m_techniqueGL3->addRenderPass(m_renderPassGL3);
+
+ m_techniqueGLES->graphicsApiFilter()->setApi(Qt3DRender::QGraphicsApiFilter::OpenGLES);
+ m_techniqueGLES->graphicsApiFilter()->setMajorVersion(2);
+ m_techniqueGLES->graphicsApiFilter()->setMinorVersion(0);
+ m_techniqueGLES->graphicsApiFilter()->setProfile(Qt3DRender::QGraphicsApiFilter::NoProfile);
+
+ m_techniqueGL2->graphicsApiFilter()->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL);
+ m_techniqueGL2->graphicsApiFilter()->setMajorVersion(2);
+ m_techniqueGL2->graphicsApiFilter()->setMinorVersion(0);
+ m_techniqueGL2->graphicsApiFilter()->setProfile(Qt3DRender::QGraphicsApiFilter::NoProfile);
+
+ m_techniqueGL3->graphicsApiFilter()->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL);
+ m_techniqueGL3->graphicsApiFilter()->setMajorVersion(3);
+ m_techniqueGL3->graphicsApiFilter()->setMinorVersion(1);
+ m_techniqueGL3->graphicsApiFilter()->setProfile(Qt3DRender::QGraphicsApiFilter::CoreProfile);
+}
+
diff --git a/tests/manual/render-qml-to-texture/planematerial.h b/tests/manual/render-qml-to-texture/planematerial.h
new file mode 100644
index 000000000..8de7a19c9
--- /dev/null
+++ b/tests/manual/render-qml-to-texture/planematerial.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef PLANEMATERIAL_H
+#define PLANEMATERIAL_H
+
+#include <Qt3DRender/QMaterial>
+#include <Qt3DRender/QFilterKey>
+#include <Qt3DRender/QTechnique>
+#include <Qt3DRender/QMaterial>
+
+class PlaneMaterial : public Qt3DRender::QMaterial
+{
+public:
+ explicit PlaneMaterial(Qt3DRender::QAbstractTexture *texture, Qt3DCore::QNode *parent = nullptr);
+private:
+ Qt3DRender::QEffect *m_effect;
+ Qt3DRender::QAbstractTexture *m_texture;
+ Qt3DRender::QParameter *m_textureParam, *m_texCoordScaleParam, *m_texCoordBiasParam;
+ Qt3DRender::QFilterKey *m_filter;
+ Qt3DRender::QTechnique *m_techniqueGLES, *m_techniqueGL3, *m_techniqueGL2;
+ Qt3DRender::QShaderProgram *m_programGLES, *m_programGL3;
+ Qt3DRender::QRenderPass *m_renderPassGLES, *m_renderPassGL3, *m_renderPassGL2;
+};
+
+#endif // PLANEMATERIAL_H
diff --git a/tests/manual/render-qml-to-texture/render-qml-to-texture.pri b/tests/manual/render-qml-to-texture/render-qml-to-texture.pri
new file mode 100644
index 000000000..b02c23840
--- /dev/null
+++ b/tests/manual/render-qml-to-texture/render-qml-to-texture.pri
@@ -0,0 +1,6 @@
+SOURCES +=
+
+RESOURCES += \
+ ../render-qml-to-texture/render-qml-to-texture.qrc
+
+HEADERS +=
diff --git a/tests/manual/render-qml-to-texture/render-qml-to-texture.pro b/tests/manual/render-qml-to-texture/render-qml-to-texture.pro
new file mode 100644
index 000000000..45c213803
--- /dev/null
+++ b/tests/manual/render-qml-to-texture/render-qml-to-texture.pro
@@ -0,0 +1,21 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dextras 3dcore 3drender 3dinput 3dquick qml quick 3dquickrender 3dquickscene2d
+
+SOURCES += main.cpp \
+ planematerial.cpp
+
+RESOURCES += \
+ render-qml-to-texture.qrc
+
+OTHER_FILES += \
+ main.qml
+
+DISTFILES += \
+ OffscreenGui.qml \
+ TextRectangle.qml
+
+HEADERS += \
+ planematerial.h
diff --git a/tests/manual/render-qml-to-texture/render-qml-to-texture.qrc b/tests/manual/render-qml-to-texture/render-qml-to-texture.qrc
new file mode 100644
index 000000000..792a74b70
--- /dev/null
+++ b/tests/manual/render-qml-to-texture/render-qml-to-texture.qrc
@@ -0,0 +1,10 @@
+<RCC>
+ <qresource prefix="/">
+ <file>shaders/es2/texturing.frag</file>
+ <file>shaders/es2/texturing.vert</file>
+ <file>shaders/gl3/texturing.frag</file>
+ <file>shaders/gl3/texturing.vert</file>
+ <file>OffscreenGui.qml</file>
+ <file>TextRectangle.qml</file>
+ </qresource>
+</RCC>
diff --git a/tests/manual/render-qml-to-texture/shaders/es2/texturing.frag b/tests/manual/render-qml-to-texture/shaders/es2/texturing.frag
new file mode 100644
index 000000000..b651bd5ed
--- /dev/null
+++ b/tests/manual/render-qml-to-texture/shaders/es2/texturing.frag
@@ -0,0 +1,16 @@
+#define FP highp
+
+uniform FP vec3 eyePosition;
+
+uniform sampler2D surfaceTexture;
+
+varying FP vec3 worldPosition;
+varying FP vec3 worldNormal;
+varying FP vec2 texCoord;
+
+
+
+void main()
+{
+ gl_FragColor = texture2D(surfaceTexture, texCoord);
+}
diff --git a/tests/manual/render-qml-to-texture/shaders/es2/texturing.vert b/tests/manual/render-qml-to-texture/shaders/es2/texturing.vert
new file mode 100644
index 000000000..cfbd338d2
--- /dev/null
+++ b/tests/manual/render-qml-to-texture/shaders/es2/texturing.vert
@@ -0,0 +1,26 @@
+
+
+attribute vec3 vertexPosition;
+attribute vec3 vertexNormal;
+attribute vec2 vertexTexCoord;
+
+varying vec3 worldPosition;
+varying vec3 worldNormal;
+varying vec2 texCoord;
+
+uniform mat4 modelMatrix;
+uniform mat3 modelNormalMatrix;
+uniform mat4 mvp;
+
+uniform vec2 texCoordScale;
+uniform vec2 texCoordBias;
+
+void main()
+{
+ texCoord = vertexTexCoord * texCoordScale + texCoordBias;
+ worldNormal = normalize(modelNormalMatrix * vertexNormal);
+ worldPosition = vec3(modelMatrix * vec4(vertexPosition, 1.0));
+
+ gl_Position = mvp * vec4(vertexPosition, 1.0);
+}
+
diff --git a/tests/manual/render-qml-to-texture/shaders/gl3/texturing.frag b/tests/manual/render-qml-to-texture/shaders/gl3/texturing.frag
new file mode 100644
index 000000000..b051dc254
--- /dev/null
+++ b/tests/manual/render-qml-to-texture/shaders/gl3/texturing.frag
@@ -0,0 +1,16 @@
+#version 150 core
+
+uniform vec3 eyePosition;
+
+uniform sampler2D surfaceTexture;
+
+in vec3 worldPosition;
+in vec3 worldNormal;
+in vec2 texCoord;
+
+out vec4 fragColor;
+
+void main()
+{
+ fragColor = texture(surfaceTexture, texCoord);
+}
diff --git a/tests/manual/render-qml-to-texture/shaders/gl3/texturing.vert b/tests/manual/render-qml-to-texture/shaders/gl3/texturing.vert
new file mode 100644
index 000000000..2b8a08b0a
--- /dev/null
+++ b/tests/manual/render-qml-to-texture/shaders/gl3/texturing.vert
@@ -0,0 +1,25 @@
+#version 150 core
+
+in vec3 vertexPosition;
+in vec3 vertexNormal;
+in vec2 vertexTexCoord;
+
+out vec3 worldPosition;
+out vec3 worldNormal;
+out vec2 texCoord;
+
+uniform mat4 modelMatrix;
+uniform mat3 modelNormalMatrix;
+uniform mat4 mvp;
+
+uniform vec2 texCoordScale;
+uniform vec2 texCoordBias;
+
+void main()
+{
+ texCoord = vertexTexCoord * texCoordScale + texCoordBias;
+ worldNormal = normalize(modelNormalMatrix * vertexNormal);
+ worldPosition = vec3(modelMatrix * vec4(vertexPosition, 1.0));
+
+ gl_Position = mvp * vec4(vertexPosition, 1.0);
+}