summaryrefslogtreecommitdiffstats
path: root/tests/manual/qopenglwidget/dockedopenglwidget/mainwidget.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/qopenglwidget/dockedopenglwidget/mainwidget.h')
-rw-r--r--tests/manual/qopenglwidget/dockedopenglwidget/mainwidget.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/manual/qopenglwidget/dockedopenglwidget/mainwidget.h b/tests/manual/qopenglwidget/dockedopenglwidget/mainwidget.h
new file mode 100644
index 0000000000..b21131d485
--- /dev/null
+++ b/tests/manual/qopenglwidget/dockedopenglwidget/mainwidget.h
@@ -0,0 +1,57 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef MAINWIDGET_H
+#define MAINWIDGET_H
+
+#include "geometryengine.h"
+
+#include <QOpenGLWidget>
+#include <QOpenGLFunctions>
+#include <QMatrix4x4>
+#include <QQuaternion>
+#include <QVector2D>
+#include <QBasicTimer>
+#include <QOpenGLShaderProgram>
+#include <QOpenGLTexture>
+
+class GeometryEngine;
+
+class MainWidget : public QOpenGLWidget, protected QOpenGLFunctions
+{
+ Q_OBJECT
+
+public:
+ using QOpenGLWidget::QOpenGLWidget;
+ ~MainWidget();
+
+protected:
+ void mousePressEvent(QMouseEvent *e) override;
+ void mouseReleaseEvent(QMouseEvent *e) override;
+ void timerEvent(QTimerEvent *e) override;
+
+ void initializeGL() override;
+ void resizeGL(int w, int h) override;
+ void paintGL() override;
+
+ void initShaders();
+ void initTextures();
+
+private slots:
+ void cleanup();
+
+private:
+ QBasicTimer timer;
+ QOpenGLShaderProgram *program = nullptr;
+ GeometryEngine *geometries = nullptr;
+ QOpenGLTexture *texture = nullptr;
+
+ QMatrix4x4 projection;
+
+ QVector2D mousePressPosition;
+ QVector3D rotationAxis;
+ qreal angularSpeed = 0;
+ QQuaternion rotation;
+};
+
+#endif // MAINWIDGET_H