05fc3aef53
Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
52 lines
1.3 KiB
C++
52 lines
1.3 KiB
C++
// Copyright (C) 2016 The Qt Company Ltd.
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
|
|
|
#ifndef GLWIDGET_H
|
|
#define GLWIDGET_H
|
|
|
|
#include <QOpenGLWidget>
|
|
#include <QOpenGLFunctions>
|
|
#include <QOpenGLBuffer>
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QOpenGLShaderProgram);
|
|
QT_FORWARD_DECLARE_CLASS(QOpenGLTexture)
|
|
|
|
class GLWidget : public QOpenGLWidget, protected QOpenGLFunctions
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
using QOpenGLWidget::QOpenGLWidget;
|
|
~GLWidget();
|
|
|
|
QSize minimumSizeHint() const override;
|
|
QSize sizeHint() const override;
|
|
void rotateBy(int xAngle, int yAngle, int zAngle);
|
|
void setClearColor(const QColor &color);
|
|
|
|
signals:
|
|
void clicked();
|
|
|
|
protected:
|
|
void initializeGL() override;
|
|
void paintGL() override;
|
|
void resizeGL(int width, int height) override;
|
|
void mousePressEvent(QMouseEvent *event) override;
|
|
void mouseMoveEvent(QMouseEvent *event) override;
|
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
|
|
|
private:
|
|
void makeObject();
|
|
|
|
QColor clearColor = Qt::black;
|
|
QPoint lastPos;
|
|
int xRot = 0;
|
|
int yRot = 0;
|
|
int zRot = 0;
|
|
QOpenGLTexture *textures[6] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr};
|
|
QOpenGLShaderProgram *program = nullptr;
|
|
QOpenGLBuffer vbo;
|
|
};
|
|
|
|
#endif
|