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>
64 lines
1.6 KiB
C++
64 lines
1.6 KiB
C++
// Copyright (C) 2017 The Qt Company Ltd.
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
|
|
|
#ifndef GLWIDGET_H
|
|
#define GLWIDGET_H
|
|
|
|
#include <QOpenGLWindow>
|
|
#include <QOpenGLTexture>
|
|
#include <QMatrix4x4>
|
|
#include <QVector3D>
|
|
#include <QKeyEvent>
|
|
#include <QPropertyAnimation>
|
|
#include <QSequentialAnimationGroup>
|
|
#include <QRectF>
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
class QOpenGLTexture;
|
|
class QOpenGLShaderProgram;
|
|
class QOpenGLBuffer;
|
|
class QOpenGLVertexArrayObject;
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
class GLWindow : public QOpenGLWindow
|
|
{
|
|
Q_OBJECT
|
|
Q_PROPERTY(float blurRadius READ blurRadius WRITE setBlurRadius)
|
|
|
|
public:
|
|
GLWindow();
|
|
~GLWindow();
|
|
|
|
void initializeGL() override;
|
|
void resizeGL(int w, int h) override;
|
|
void paintGL() override;
|
|
|
|
float blurRadius() const { return m_blurRadius; }
|
|
void setBlurRadius(float blurRadius);
|
|
|
|
protected:
|
|
void keyPressEvent(QKeyEvent *e) override;
|
|
void setAnimating(bool animate);
|
|
|
|
private:
|
|
QPropertyAnimation *m_animationForward = nullptr;
|
|
QPropertyAnimation *m_animationBackward = nullptr;
|
|
QSequentialAnimationGroup *m_animationGroup;
|
|
QOpenGLTexture *m_texImageInput = nullptr;
|
|
QOpenGLTexture *m_texImageTmp = nullptr;
|
|
QOpenGLTexture *m_texImageProcessed = nullptr;
|
|
QOpenGLShaderProgram *m_shaderDisplay = nullptr;
|
|
QOpenGLShaderProgram *m_shaderComputeV = nullptr;
|
|
QOpenGLShaderProgram *m_shaderComputeH = nullptr;
|
|
QMatrix4x4 m_proj;
|
|
QSizeF m_quadSize;
|
|
|
|
int m_blurRadius = 0;
|
|
bool m_animate = true;
|
|
QOpenGLVertexArrayObject *m_vao = nullptr;
|
|
};
|
|
|
|
#endif
|