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>
66 lines
1.4 KiB
C++
66 lines
1.4 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 <QOpenGLWindow>
|
|
#include <QMatrix4x4>
|
|
#include <QVector3D>
|
|
#include "../hellogl2/logo.h"
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
class QOpenGLTexture;
|
|
class QOpenGLShaderProgram;
|
|
class QOpenGLBuffer;
|
|
class QOpenGLVertexArrayObject;
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
class GLWindow : public QOpenGLWindow
|
|
{
|
|
Q_OBJECT
|
|
Q_PROPERTY(float z READ z WRITE setZ)
|
|
Q_PROPERTY(float r READ r WRITE setR)
|
|
Q_PROPERTY(float r2 READ r2 WRITE setR2)
|
|
|
|
public:
|
|
GLWindow();
|
|
~GLWindow();
|
|
|
|
void initializeGL();
|
|
void resizeGL(int w, int h);
|
|
void paintGL();
|
|
|
|
float z() const { return m_eye.z(); }
|
|
void setZ(float v);
|
|
|
|
float r() const { return m_r; }
|
|
void setR(float v);
|
|
float r2() const { return m_r2; }
|
|
void setR2(float v);
|
|
private slots:
|
|
void startSecondStage();
|
|
private:
|
|
QOpenGLTexture *m_texture = nullptr;
|
|
QOpenGLShaderProgram *m_program = nullptr;
|
|
QOpenGLBuffer *m_vbo = nullptr;
|
|
QOpenGLVertexArrayObject *m_vao = nullptr;
|
|
Logo m_logo;
|
|
int m_projMatrixLoc = 0;
|
|
int m_camMatrixLoc = 0;
|
|
int m_worldMatrixLoc = 0;
|
|
int m_myMatrixLoc = 0;
|
|
int m_lightPosLoc = 0;
|
|
QMatrix4x4 m_proj;
|
|
QMatrix4x4 m_world;
|
|
QVector3D m_eye;
|
|
QVector3D m_target = {0, 0, -1};
|
|
bool m_uniformsDirty = true;
|
|
float m_r = 0;
|
|
float m_r2 = 0;
|
|
};
|
|
|
|
#endif
|