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>
49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
// Copyright (C) 2016 The Qt Company Ltd.
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
|
|
|
#ifndef RENDERWINDOW_H
|
|
#define RENDERWINDOW_H
|
|
|
|
#include <QWindow>
|
|
#include <QOpenGLVertexArrayObject>
|
|
#include <QOpenGLBuffer>
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QOpenGLContext)
|
|
QT_FORWARD_DECLARE_CLASS(QOpenGLShaderProgram)
|
|
|
|
class RenderWindow : public QWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
RenderWindow(const QSurfaceFormat &format);
|
|
QOpenGLContext *context() { return m_context; }
|
|
void exposeEvent(QExposeEvent *) override;
|
|
void setForceGLSL110(bool enable) { m_forceGLSL110 = enable; }
|
|
|
|
signals:
|
|
void ready();
|
|
void error(const QString &msg);
|
|
|
|
protected:
|
|
bool event(QEvent *ev) override;
|
|
|
|
private slots:
|
|
void render();
|
|
|
|
private:
|
|
void init();
|
|
void setupVertexAttribs();
|
|
|
|
QOpenGLContext *m_context;
|
|
bool m_initialized;
|
|
bool m_forceGLSL110;
|
|
QOpenGLShaderProgram *m_program;
|
|
int m_posAttr, m_colAttr, m_matrixUniform;
|
|
QOpenGLVertexArrayObject m_vao;
|
|
QOpenGLBuffer m_vbo;
|
|
float m_angle;
|
|
};
|
|
|
|
#endif // RENDERWINDOW_H
|