summaryrefslogtreecommitdiffstats
path: root/examples/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'examples/opengl')
-rw-r--r--examples/opengl/2dpainting/2dpainting.pro2
-rw-r--r--examples/opengl/2dpainting/glwidget.cpp2
-rw-r--r--examples/opengl/2dpainting/helper.cpp2
-rw-r--r--examples/opengl/2dpainting/widget.cpp2
-rw-r--r--examples/opengl/2dpainting/window.cpp2
-rw-r--r--examples/opengl/cube/cube.pro2
-rw-r--r--examples/opengl/cube/main.cpp2
-rw-r--r--examples/opengl/framebufferobject2/framebufferobject2.pro2
-rw-r--r--examples/opengl/framebufferobject2/main.cpp4
-rw-r--r--examples/opengl/grabber/glwidget.cpp2
-rw-r--r--examples/opengl/grabber/grabber.pro2
-rw-r--r--examples/opengl/grabber/mainwindow.cpp2
-rw-r--r--examples/opengl/hellogl/glwidget.cpp2
-rw-r--r--examples/opengl/hellogl/hellogl.pro2
-rw-r--r--examples/opengl/hellogl/window.cpp2
-rw-r--r--examples/opengl/hellogl_es/bubble.cpp2
-rw-r--r--examples/opengl/hellogl_es/hellogl_es.pro2
-rw-r--r--examples/opengl/hellogl_es2/bubble.cpp2
-rw-r--r--examples/opengl/hellogl_es2/hellogl_es2.pro2
-rw-r--r--examples/opengl/hellowindow/hellowindow.cpp277
-rw-r--r--examples/opengl/hellowindow/hellowindow.h60
-rw-r--r--examples/opengl/hellowindow/hellowindow.pro14
-rw-r--r--examples/opengl/hellowindow/main.cpp18
-rw-r--r--examples/opengl/opengl.pro5
-rw-r--r--examples/opengl/overpainting/bubble.cpp2
-rw-r--r--examples/opengl/overpainting/glwidget.cpp2
-rw-r--r--examples/opengl/overpainting/overpainting.pro2
-rw-r--r--examples/opengl/pbuffers/main.cpp4
-rw-r--r--examples/opengl/pbuffers/pbuffers.pro2
-rw-r--r--examples/opengl/pbuffers2/main.cpp4
-rw-r--r--examples/opengl/pbuffers2/pbuffers2.pro2
-rw-r--r--examples/opengl/samplebuffers/main.cpp4
-rw-r--r--examples/opengl/samplebuffers/samplebuffers.pro2
-rw-r--r--examples/opengl/textures/glwidget.cpp2
-rw-r--r--examples/opengl/textures/glwidget.h2
-rw-r--r--examples/opengl/textures/textures.pro2
-rw-r--r--examples/opengl/textures/window.cpp2
37 files changed, 410 insertions, 36 deletions
diff --git a/examples/opengl/2dpainting/2dpainting.pro b/examples/opengl/2dpainting/2dpainting.pro
index ac88b9940a..5d361bc1bf 100644
--- a/examples/opengl/2dpainting/2dpainting.pro
+++ b/examples/opengl/2dpainting/2dpainting.pro
@@ -1,4 +1,4 @@
-QT += opengl
+QT += opengl widgets
HEADERS = glwidget.h \
helper.h \
diff --git a/examples/opengl/2dpainting/glwidget.cpp b/examples/opengl/2dpainting/glwidget.cpp
index 8b28a6e6a3..800e947385 100644
--- a/examples/opengl/2dpainting/glwidget.cpp
+++ b/examples/opengl/2dpainting/glwidget.cpp
@@ -38,7 +38,7 @@
**
****************************************************************************/
-#include <QtGui>
+#include <QtWidgets>
#include "glwidget.h"
#include "helper.h"
diff --git a/examples/opengl/2dpainting/helper.cpp b/examples/opengl/2dpainting/helper.cpp
index 662a4264a7..dc18c60a4b 100644
--- a/examples/opengl/2dpainting/helper.cpp
+++ b/examples/opengl/2dpainting/helper.cpp
@@ -38,7 +38,7 @@
**
****************************************************************************/
-#include <QtGui>
+#include <QtWidgets>
#include "helper.h"
//! [0]
diff --git a/examples/opengl/2dpainting/widget.cpp b/examples/opengl/2dpainting/widget.cpp
index 16398147c7..35eedae240 100644
--- a/examples/opengl/2dpainting/widget.cpp
+++ b/examples/opengl/2dpainting/widget.cpp
@@ -38,7 +38,7 @@
**
****************************************************************************/
-#include <QtGui>
+#include <QtWidgets>
#include "widget.h"
#include "helper.h"
diff --git a/examples/opengl/2dpainting/window.cpp b/examples/opengl/2dpainting/window.cpp
index d2c8ef706c..0186670f38 100644
--- a/examples/opengl/2dpainting/window.cpp
+++ b/examples/opengl/2dpainting/window.cpp
@@ -38,7 +38,7 @@
**
****************************************************************************/
-#include <QtGui>
+#include <QtWidgets>
#include "glwidget.h"
#include "widget.h"
#include "window.h"
diff --git a/examples/opengl/cube/cube.pro b/examples/opengl/cube/cube.pro
index a11aaf6bc7..652812b718 100644
--- a/examples/opengl/cube/cube.pro
+++ b/examples/opengl/cube/cube.pro
@@ -4,7 +4,7 @@
#
#-------------------------------------------------
-QT += core gui
+QT += core gui widgets
TARGET = cube
TEMPLATE = app
diff --git a/examples/opengl/cube/main.cpp b/examples/opengl/cube/main.cpp
index c75fd0826a..ef6efdc4dc 100644
--- a/examples/opengl/cube/main.cpp
+++ b/examples/opengl/cube/main.cpp
@@ -38,7 +38,7 @@
**
****************************************************************************/
-#include <QtGui/QApplication>
+#include <QApplication>
#include <QLabel>
#ifndef QT_NO_OPENGL
diff --git a/examples/opengl/framebufferobject2/framebufferobject2.pro b/examples/opengl/framebufferobject2/framebufferobject2.pro
index d2787853e0..d3fce133fa 100644
--- a/examples/opengl/framebufferobject2/framebufferobject2.pro
+++ b/examples/opengl/framebufferobject2/framebufferobject2.pro
@@ -2,7 +2,7 @@ HEADERS += glwidget.h
SOURCES += glwidget.cpp main.cpp
RESOURCES += framebufferobject2.qrc
-QT += opengl
+QT += opengl widgets
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/framebufferobject2
diff --git a/examples/opengl/framebufferobject2/main.cpp b/examples/opengl/framebufferobject2/main.cpp
index 12e5a62cdd..313e683da5 100644
--- a/examples/opengl/framebufferobject2/main.cpp
+++ b/examples/opengl/framebufferobject2/main.cpp
@@ -38,8 +38,8 @@
**
****************************************************************************/
-#include <QtGui/QApplication>
-#include <QtGui/QMessageBox>
+#include <QtWidgets/QApplication>
+#include <QtWidgets/QMessageBox>
#include "glwidget.h"
int main(int argc, char **argv)
diff --git a/examples/opengl/grabber/glwidget.cpp b/examples/opengl/grabber/glwidget.cpp
index 72039a7b66..52d0b2662a 100644
--- a/examples/opengl/grabber/glwidget.cpp
+++ b/examples/opengl/grabber/glwidget.cpp
@@ -38,7 +38,7 @@
**
****************************************************************************/
-#include <QtGui>
+#include <QtWidgets>
#include <QtOpenGL>
#include <math.h>
diff --git a/examples/opengl/grabber/grabber.pro b/examples/opengl/grabber/grabber.pro
index e9f371b6ad..6a73201cd2 100644
--- a/examples/opengl/grabber/grabber.pro
+++ b/examples/opengl/grabber/grabber.pro
@@ -3,7 +3,7 @@ HEADERS = glwidget.h \
SOURCES = glwidget.cpp \
main.cpp \
mainwindow.cpp
-QT += opengl
+QT += opengl widgets
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/grabber
diff --git a/examples/opengl/grabber/mainwindow.cpp b/examples/opengl/grabber/mainwindow.cpp
index d2f3a98dce..965c49ab1a 100644
--- a/examples/opengl/grabber/mainwindow.cpp
+++ b/examples/opengl/grabber/mainwindow.cpp
@@ -38,7 +38,7 @@
**
****************************************************************************/
-#include <QtGui>
+#include <QtWidgets>
#include <QtOpenGL>
#include "glwidget.h"
diff --git a/examples/opengl/hellogl/glwidget.cpp b/examples/opengl/hellogl/glwidget.cpp
index 59efb12368..38333d8560 100644
--- a/examples/opengl/hellogl/glwidget.cpp
+++ b/examples/opengl/hellogl/glwidget.cpp
@@ -38,7 +38,7 @@
**
****************************************************************************/
-#include <QtGui>
+#include <QtWidgets>
#include <QtOpenGL>
#include <math.h>
diff --git a/examples/opengl/hellogl/hellogl.pro b/examples/opengl/hellogl/hellogl.pro
index 0c81aae5c1..82372c5d98 100644
--- a/examples/opengl/hellogl/hellogl.pro
+++ b/examples/opengl/hellogl/hellogl.pro
@@ -8,7 +8,7 @@ SOURCES = glwidget.cpp \
main.cpp \
window.cpp \
qtlogo.cpp
-QT += opengl
+QT += opengl widgets
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/hellogl
diff --git a/examples/opengl/hellogl/window.cpp b/examples/opengl/hellogl/window.cpp
index ef7cc2ad09..9f7d6be68b 100644
--- a/examples/opengl/hellogl/window.cpp
+++ b/examples/opengl/hellogl/window.cpp
@@ -38,7 +38,7 @@
**
****************************************************************************/
-#include <QtGui>
+#include <QtWidgets>
#include "glwidget.h"
#include "window.h"
diff --git a/examples/opengl/hellogl_es/bubble.cpp b/examples/opengl/hellogl_es/bubble.cpp
index 167d9abd92..6db14e32bd 100644
--- a/examples/opengl/hellogl_es/bubble.cpp
+++ b/examples/opengl/hellogl_es/bubble.cpp
@@ -38,7 +38,7 @@
**
****************************************************************************/
-#include <QtGui>
+#include <QtWidgets>
#include "bubble.h"
diff --git a/examples/opengl/hellogl_es/hellogl_es.pro b/examples/opengl/hellogl_es/hellogl_es.pro
index c25ab30235..5a3eec51c4 100644
--- a/examples/opengl/hellogl_es/hellogl_es.pro
+++ b/examples/opengl/hellogl_es/hellogl_es.pro
@@ -17,7 +17,7 @@ HEADERS += mainwindow.h
HEADERS += bubble.h
RESOURCES += texture.qrc
-QT += opengl
+QT += opengl widgets
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/hellogl_es
diff --git a/examples/opengl/hellogl_es2/bubble.cpp b/examples/opengl/hellogl_es2/bubble.cpp
index 167d9abd92..6db14e32bd 100644
--- a/examples/opengl/hellogl_es2/bubble.cpp
+++ b/examples/opengl/hellogl_es2/bubble.cpp
@@ -38,7 +38,7 @@
**
****************************************************************************/
-#include <QtGui>
+#include <QtWidgets>
#include "bubble.h"
diff --git a/examples/opengl/hellogl_es2/hellogl_es2.pro b/examples/opengl/hellogl_es2/hellogl_es2.pro
index 4061a0f678..2eef986ed2 100644
--- a/examples/opengl/hellogl_es2/hellogl_es2.pro
+++ b/examples/opengl/hellogl_es2/hellogl_es2.pro
@@ -17,7 +17,7 @@ HEADERS += mainwindow.h
HEADERS += bubble.h
RESOURCES += texture.qrc
-QT += opengl
+QT += opengl widgets
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/hellogl_es2
diff --git a/examples/opengl/hellowindow/hellowindow.cpp b/examples/opengl/hellowindow/hellowindow.cpp
new file mode 100644
index 0000000000..5a232e6a7b
--- /dev/null
+++ b/examples/opengl/hellowindow/hellowindow.cpp
@@ -0,0 +1,277 @@
+#include "hellowindow.h"
+
+#include <QGuiGLContext>
+
+#include <QTimer>
+
+#include <qmath.h>
+
+Renderer::Renderer()
+ : m_initialized(false)
+{
+ m_format.setDepthBufferSize(16);
+ m_format.setSamples(4);
+
+ m_context = new QGuiGLContext;
+ m_context->setFormat(m_format);
+ m_context->create();
+}
+
+QSurfaceFormat Renderer::format() const
+{
+ return m_format;
+}
+
+HelloWindow::HelloWindow(Renderer *renderer)
+ : m_colorIndex(0)
+ , m_renderer(renderer)
+{
+ setSurfaceType(QWindow::OpenGLSurface);
+ setWindowTitle(QLatin1String("Hello Window"));
+
+ setFormat(renderer->format());
+
+ setGeometry(QRect(10, 10, 640, 480));
+
+ create();
+
+ QTimer *timer = new QTimer(this);
+ connect(timer, SIGNAL(timeout()), this, SLOT(render()));
+ timer->start(10);
+
+ updateColor();
+}
+
+void HelloWindow::mousePressEvent(QMouseEvent *)
+{
+ updateColor();
+}
+
+void HelloWindow::updateColor()
+{
+ QColor colors[] =
+ {
+ QColor(100, 255, 0),
+ QColor(0, 100, 255)
+ };
+
+ m_color = colors[m_colorIndex];
+
+ m_colorIndex++;
+ if (m_colorIndex >= int(sizeof(colors) / sizeof(colors[0])))
+ m_colorIndex = 0;
+}
+
+void HelloWindow::render()
+{
+ m_renderer->render(this, m_color, geometry().size());
+}
+
+void Renderer::render(QSurface *surface, const QColor &color, const QSize &viewSize)
+{
+ if (!m_context->makeCurrent(surface))
+ return;
+
+ if (!m_initialized) {
+ initialize();
+ m_initialized = true;
+ }
+
+ glViewport(0, 0, viewSize.width(), viewSize.height());
+
+ glClearColor(0.1f, 0.1f, 0.2f, 1.0f);
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ glFrontFace(GL_CW);
+ glCullFace(GL_FRONT);
+ glEnable(GL_CULL_FACE);
+ glEnable(GL_DEPTH_TEST);
+
+ QMatrix4x4 modelview;
+ modelview.rotate(m_fAngle, 0.0f, 1.0f, 0.0f);
+ modelview.rotate(m_fAngle, 1.0f, 0.0f, 0.0f);
+ modelview.rotate(m_fAngle, 0.0f, 0.0f, 1.0f);
+ modelview.translate(0.0f, -0.2f, 0.0f);
+
+ program.bind();
+ program.setUniformValue(matrixUniform, modelview);
+ program.setUniformValue(colorUniform, color);
+ paintQtLogo();
+ program.release();
+
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_CULL_FACE);
+
+ m_context->swapBuffers(surface);
+
+ m_fAngle += 1.0f;
+}
+
+void Renderer::paintQtLogo()
+{
+ program.enableAttributeArray(normalAttr);
+ program.enableAttributeArray(vertexAttr);
+ program.setAttributeArray(vertexAttr, vertices.constData());
+ program.setAttributeArray(normalAttr, normals.constData());
+ glDrawArrays(GL_TRIANGLES, 0, vertices.size());
+ program.disableAttributeArray(normalAttr);
+ program.disableAttributeArray(vertexAttr);
+}
+
+void Renderer::initialize()
+{
+ glClearColor(0.1f, 0.1f, 0.2f, 1.0f);
+
+ QGLShader *vshader = new QGLShader(QGLShader::Vertex, this);
+ const char *vsrc =
+ "attribute highp vec4 vertex;\n"
+ "attribute mediump vec3 normal;\n"
+ "uniform mediump mat4 matrix;\n"
+ "uniform lowp vec4 sourceColor;\n"
+ "varying mediump vec4 color;\n"
+ "void main(void)\n"
+ "{\n"
+ " vec3 toLight = normalize(vec3(0.0, 0.3, 1.0));\n"
+ " float angle = max(dot(normal, toLight), 0.0);\n"
+ " vec3 col = sourceColor.rgb;\n"
+ " color = vec4(col * 0.2 + col * 0.8 * angle, 1.0);\n"
+ " color = clamp(color, 0.0, 1.0);\n"
+ " gl_Position = matrix * vertex;\n"
+ "}\n";
+ vshader->compileSourceCode(vsrc);
+
+ QGLShader *fshader = new QGLShader(QGLShader::Fragment, this);
+ const char *fsrc =
+ "varying mediump vec4 color;\n"
+ "void main(void)\n"
+ "{\n"
+ " gl_FragColor = color;\n"
+ "}\n";
+ fshader->compileSourceCode(fsrc);
+
+ program.addShader(vshader);
+ program.addShader(fshader);
+ program.link();
+
+ vertexAttr = program.attributeLocation("vertex");
+ normalAttr = program.attributeLocation("normal");
+ matrixUniform = program.uniformLocation("matrix");
+ colorUniform = program.uniformLocation("sourceColor");
+
+ m_fAngle = 0;
+ createGeometry();
+}
+
+void Renderer::createGeometry()
+{
+ vertices.clear();
+ normals.clear();
+
+ qreal x1 = +0.06f;
+ qreal y1 = -0.14f;
+ qreal x2 = +0.14f;
+ qreal y2 = -0.06f;
+ qreal x3 = +0.08f;
+ qreal y3 = +0.00f;
+ qreal x4 = +0.30f;
+ qreal y4 = +0.22f;
+
+ quad(x1, y1, x2, y2, y2, x2, y1, x1);
+ quad(x3, y3, x4, y4, y4, x4, y3, x3);
+
+ extrude(x1, y1, x2, y2);
+ extrude(x2, y2, y2, x2);
+ extrude(y2, x2, y1, x1);
+ extrude(y1, x1, x1, y1);
+ extrude(x3, y3, x4, y4);
+ extrude(x4, y4, y4, x4);
+ extrude(y4, x4, y3, x3);
+
+ const qreal Pi = 3.14159f;
+ const int NumSectors = 100;
+
+ for (int i = 0; i < NumSectors; ++i) {
+ qreal angle1 = (i * 2 * Pi) / NumSectors;
+ qreal x5 = 0.30 * qSin(angle1);
+ qreal y5 = 0.30 * qCos(angle1);
+ qreal x6 = 0.20 * qSin(angle1);
+ qreal y6 = 0.20 * qCos(angle1);
+
+ qreal angle2 = ((i + 1) * 2 * Pi) / NumSectors;
+ qreal x7 = 0.20 * qSin(angle2);
+ qreal y7 = 0.20 * qCos(angle2);
+ qreal x8 = 0.30 * qSin(angle2);
+ qreal y8 = 0.30 * qCos(angle2);
+
+ quad(x5, y5, x6, y6, x7, y7, x8, y8);
+
+ extrude(x6, y6, x7, y7);
+ extrude(x8, y8, x5, y5);
+ }
+
+ for (int i = 0;i < vertices.size();i++)
+ vertices[i] *= 2.0f;
+}
+
+void Renderer::quad(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4)
+{
+ vertices << QVector3D(x1, y1, -0.05f);
+ vertices << QVector3D(x2, y2, -0.05f);
+ vertices << QVector3D(x4, y4, -0.05f);
+
+ vertices << QVector3D(x3, y3, -0.05f);
+ vertices << QVector3D(x4, y4, -0.05f);
+ vertices << QVector3D(x2, y2, -0.05f);
+
+ QVector3D n = QVector3D::normal
+ (QVector3D(x2 - x1, y2 - y1, 0.0f), QVector3D(x4 - x1, y4 - y1, 0.0f));
+
+ normals << n;
+ normals << n;
+ normals << n;
+
+ normals << n;
+ normals << n;
+ normals << n;
+
+ vertices << QVector3D(x4, y4, 0.05f);
+ vertices << QVector3D(x2, y2, 0.05f);
+ vertices << QVector3D(x1, y1, 0.05f);
+
+ vertices << QVector3D(x2, y2, 0.05f);
+ vertices << QVector3D(x4, y4, 0.05f);
+ vertices << QVector3D(x3, y3, 0.05f);
+
+ n = QVector3D::normal
+ (QVector3D(x2 - x4, y2 - y4, 0.0f), QVector3D(x1 - x4, y1 - y4, 0.0f));
+
+ normals << n;
+ normals << n;
+ normals << n;
+
+ normals << n;
+ normals << n;
+ normals << n;
+}
+
+void Renderer::extrude(qreal x1, qreal y1, qreal x2, qreal y2)
+{
+ vertices << QVector3D(x1, y1, +0.05f);
+ vertices << QVector3D(x2, y2, +0.05f);
+ vertices << QVector3D(x1, y1, -0.05f);
+
+ vertices << QVector3D(x2, y2, -0.05f);
+ vertices << QVector3D(x1, y1, -0.05f);
+ vertices << QVector3D(x2, y2, +0.05f);
+
+ QVector3D n = QVector3D::normal
+ (QVector3D(x2 - x1, y2 - y1, 0.0f), QVector3D(0.0f, 0.0f, -0.1f));
+
+ normals << n;
+ normals << n;
+ normals << n;
+
+ normals << n;
+ normals << n;
+ normals << n;
+}
diff --git a/examples/opengl/hellowindow/hellowindow.h b/examples/opengl/hellowindow/hellowindow.h
new file mode 100644
index 0000000000..3c5388cb76
--- /dev/null
+++ b/examples/opengl/hellowindow/hellowindow.h
@@ -0,0 +1,60 @@
+#include <QWindow>
+
+#include <QtOpenGL/qgl.h>
+#include <QtOpenGL/qglshaderprogram.h>
+
+#include <QTime>
+
+class QGuiGLContext;
+
+class Renderer : public QObject
+{
+public:
+ Renderer();
+
+ QSurfaceFormat format() const;
+
+ void render(QSurface *surface, const QColor &color, const QSize &viewSize);
+
+private:
+ void initialize();
+
+ qreal m_fAngle;
+ bool m_showBubbles;
+ void paintQtLogo();
+ void createGeometry();
+ void createBubbles(int number);
+ void quad(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4);
+ void extrude(qreal x1, qreal y1, qreal x2, qreal y2);
+ QVector<QVector3D> vertices;
+ QVector<QVector3D> normals;
+ QGLShaderProgram program;
+ int vertexAttr;
+ int normalAttr;
+ int matrixUniform;
+ int colorUniform;
+
+ bool m_initialized;
+ QSurfaceFormat m_format;
+ QGuiGLContext *m_context;
+};
+
+class HelloWindow : public QWindow
+{
+ Q_OBJECT
+public:
+ HelloWindow(Renderer *renderer);
+
+private slots:
+ void render();
+
+protected:
+ void mousePressEvent(QMouseEvent *);
+
+private:
+ void updateColor();
+
+ int m_colorIndex;
+ QColor m_color;
+ Renderer *m_renderer;
+};
diff --git a/examples/opengl/hellowindow/hellowindow.pro b/examples/opengl/hellowindow/hellowindow.pro
new file mode 100644
index 0000000000..6492975d3b
--- /dev/null
+++ b/examples/opengl/hellowindow/hellowindow.pro
@@ -0,0 +1,14 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Wed Apr 27 16:40:46 2011
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+
+QT += opengl widgets
+
+# Input
+HEADERS += hellowindow.h
+SOURCES += hellowindow.cpp main.cpp
diff --git a/examples/opengl/hellowindow/main.cpp b/examples/opengl/hellowindow/main.cpp
new file mode 100644
index 0000000000..af5943adf4
--- /dev/null
+++ b/examples/opengl/hellowindow/main.cpp
@@ -0,0 +1,18 @@
+#include <QGuiApplication>
+
+#include "hellowindow.h"
+
+int main(int argc, char **argv)
+{
+ QGuiApplication app(argc, argv);
+
+ Renderer renderer;
+
+ HelloWindow windowA(&renderer);
+ windowA.setVisible(true);
+
+ HelloWindow windowB(&renderer);
+ windowB.setVisible(true);
+
+ return app.exec();
+}
diff --git a/examples/opengl/opengl.pro b/examples/opengl/opengl.pro
index 2a96807102..59ba7b8bd5 100644
--- a/examples/opengl/opengl.pro
+++ b/examples/opengl/opengl.pro
@@ -22,6 +22,10 @@ contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2){
textures
}
+qpa {
+ SUBDIRS += hellowindow
+}
+
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS opengl.pro README
@@ -29,4 +33,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl
INSTALLS += target sources
symbian: CONFIG += qt_example
+QT += widgets
maemo5: CONFIG += qt_example
diff --git a/examples/opengl/overpainting/bubble.cpp b/examples/opengl/overpainting/bubble.cpp
index eb315057fa..bb6d2b8070 100644
--- a/examples/opengl/overpainting/bubble.cpp
+++ b/examples/opengl/overpainting/bubble.cpp
@@ -38,7 +38,7 @@
**
****************************************************************************/
-#include <QtGui>
+#include <QtWidgets>
#include "bubble.h"
diff --git a/examples/opengl/overpainting/glwidget.cpp b/examples/opengl/overpainting/glwidget.cpp
index ded7bf1cf5..4572e69644 100644
--- a/examples/opengl/overpainting/glwidget.cpp
+++ b/examples/opengl/overpainting/glwidget.cpp
@@ -38,7 +38,7 @@
**
****************************************************************************/
-#include <QtGui>
+#include <QtWidgets>
#include <QtOpenGL>
#include <stdlib.h>
diff --git a/examples/opengl/overpainting/overpainting.pro b/examples/opengl/overpainting/overpainting.pro
index 6dfcf28ad1..1584c3c3d4 100644
--- a/examples/opengl/overpainting/overpainting.pro
+++ b/examples/opengl/overpainting/overpainting.pro
@@ -1,7 +1,7 @@
VPATH += ../shared
INCLUDEPATH += ../shared
-QT += opengl
+QT += opengl widgets
HEADERS = bubble.h \
glwidget.h \
qtlogo.h
diff --git a/examples/opengl/pbuffers/main.cpp b/examples/opengl/pbuffers/main.cpp
index b4f1512cfe..aac6d1939c 100644
--- a/examples/opengl/pbuffers/main.cpp
+++ b/examples/opengl/pbuffers/main.cpp
@@ -38,8 +38,8 @@
**
****************************************************************************/
-#include <QtGui/QApplication>
-#include <QtGui/QMessageBox>
+#include <QtWidgets/QApplication>
+#include <QtWidgets/QMessageBox>
#include <QtOpenGL/QGLPixelBuffer>
#include "glwidget.h"
diff --git a/examples/opengl/pbuffers/pbuffers.pro b/examples/opengl/pbuffers/pbuffers.pro
index 755ed8c6a8..3264be3cef 100644
--- a/examples/opengl/pbuffers/pbuffers.pro
+++ b/examples/opengl/pbuffers/pbuffers.pro
@@ -4,7 +4,7 @@ SOURCES += glwidget.cpp \
main.cpp \
cube.cpp
RESOURCES += pbuffers.qrc
-QT += opengl
+QT += opengl widgets
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/pbuffers
diff --git a/examples/opengl/pbuffers2/main.cpp b/examples/opengl/pbuffers2/main.cpp
index 0abe0b9faa..573b7f2cda 100644
--- a/examples/opengl/pbuffers2/main.cpp
+++ b/examples/opengl/pbuffers2/main.cpp
@@ -38,8 +38,8 @@
**
****************************************************************************/
-#include <QtGui/QApplication>
-#include <QtGui/QMessageBox>
+#include <QtWidgets/QApplication>
+#include <QtWidgets/QMessageBox>
#include "glwidget.h"
int main(int argc, char **argv)
diff --git a/examples/opengl/pbuffers2/pbuffers2.pro b/examples/opengl/pbuffers2/pbuffers2.pro
index d70981879d..9b30d793b8 100644
--- a/examples/opengl/pbuffers2/pbuffers2.pro
+++ b/examples/opengl/pbuffers2/pbuffers2.pro
@@ -6,7 +6,7 @@ TEMPLATE = app
DEPENDPATH += .
INCLUDEPATH += .
-QT += opengl svg
+QT += opengl svg widgets
# Input
HEADERS += glwidget.h
diff --git a/examples/opengl/samplebuffers/main.cpp b/examples/opengl/samplebuffers/main.cpp
index 8d4df924dd..c940541327 100644
--- a/examples/opengl/samplebuffers/main.cpp
+++ b/examples/opengl/samplebuffers/main.cpp
@@ -38,8 +38,8 @@
**
****************************************************************************/
-#include <QtGui/QApplication>
-#include <QtGui/QMessageBox>
+#include <QtWidgets/QApplication>
+#include <QtWidgets/QMessageBox>
#include "glwidget.h"
int main(int argc, char **argv)
diff --git a/examples/opengl/samplebuffers/samplebuffers.pro b/examples/opengl/samplebuffers/samplebuffers.pro
index a8938b9dc1..d8f9ff1cd7 100644
--- a/examples/opengl/samplebuffers/samplebuffers.pro
+++ b/examples/opengl/samplebuffers/samplebuffers.pro
@@ -1,7 +1,7 @@
HEADERS += glwidget.h
SOURCES += glwidget.cpp main.cpp
-QT += opengl
+QT += opengl widgets
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/samplebuffers
diff --git a/examples/opengl/textures/glwidget.cpp b/examples/opengl/textures/glwidget.cpp
index b5374c0200..4e74cf9d1d 100644
--- a/examples/opengl/textures/glwidget.cpp
+++ b/examples/opengl/textures/glwidget.cpp
@@ -38,7 +38,7 @@
**
****************************************************************************/
-#include <QtGui>
+#include <QtWidgets>
#include <QtOpenGL>
#include "glwidget.h"
diff --git a/examples/opengl/textures/glwidget.h b/examples/opengl/textures/glwidget.h
index fd9246bef2..86dc889107 100644
--- a/examples/opengl/textures/glwidget.h
+++ b/examples/opengl/textures/glwidget.h
@@ -41,7 +41,7 @@
#ifndef GLWIDGET_H
#define GLWIDGET_H
-#include <QtGui>
+#include <QtWidgets>
#include <QGLWidget>
class QGLShaderProgram;
diff --git a/examples/opengl/textures/textures.pro b/examples/opengl/textures/textures.pro
index 5bb0d5782e..d8941b3890 100644
--- a/examples/opengl/textures/textures.pro
+++ b/examples/opengl/textures/textures.pro
@@ -4,7 +4,7 @@ SOURCES = glwidget.cpp \
main.cpp \
window.cpp
RESOURCES = textures.qrc
-QT += opengl
+QT += opengl widgets
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/textures
diff --git a/examples/opengl/textures/window.cpp b/examples/opengl/textures/window.cpp
index 50f3afecce..16f402efab 100644
--- a/examples/opengl/textures/window.cpp
+++ b/examples/opengl/textures/window.cpp
@@ -38,7 +38,7 @@
**
****************************************************************************/
-#include <QtGui>
+#include <QtWidgets>
#include "glwidget.h"
#include "window.h"