Debian Codegraph @

tests/manual/examples/opengl/contextinfo/renderwindow.h

raw
1 // Copyright (C) 2016 The Qt Company Ltd.
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4 #ifndef RENDERWINDOW_H
5 #define RENDERWINDOW_H
6
7 #include <QWindow>
8 #include <QOpenGLVertexArrayObject>
9 #include <QOpenGLBuffer>
10
11 QT_FORWARD_DECLARE_CLASS(QOpenGLContext)
12 QT_FORWARD_DECLARE_CLASS(QOpenGLShaderProgram)
13
14 class RenderWindow : public QWindow
15 {
16 Q_OBJECT
17
18 public:
19 RenderWindow(const QSurfaceFormat &format);
20 QOpenGLContext *context() { return m_context; }
21 void exposeEvent(QExposeEvent *) override;
22 void setForceGLSL110(bool enable) { m_forceGLSL110 = enable; }
23
24 signals:
25 void ready();
26 void error(const QString &msg);
27
28 protected:
29 bool event(QEvent *ev) override;
30
31 private slots:
32 void render();
33
34 private:
35 void init();
36 void setupVertexAttribs();
37
38 QOpenGLContext *m_context;
39 bool m_initialized;
40 bool m_forceGLSL110;
41 QOpenGLShaderProgram *m_program;
42 int m_posAttr, m_colAttr, m_matrixUniform;
43 QOpenGLVertexArrayObject m_vao;
44 QOpenGLBuffer m_vbo;
45 float m_angle;
46 };
47
48 #endif // RENDERWINDOW_H