xref: /OK3568_Linux_fs/app/forlinx/flapp/src/plugins/opengl/glwidget.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 #ifndef GLWIDGET_H
2 #define GLWIDGET_H
3 
4 #include <QOpenGLWidget>
5 #include <QOpenGLFunctions>
6 #include <QOpenGLBuffer>
7 #include <QVector3D>
8 #include <QMatrix4x4>
9 #include <QTime>
10 #include <QVector>
11 #include <QPushButton>
12 
13 
14 QT_FORWARD_DECLARE_CLASS(QOpenGLTexture)
QT_FORWARD_DECLARE_CLASS(QOpenGLShader)15 QT_FORWARD_DECLARE_CLASS(QOpenGLShader)
16 QT_FORWARD_DECLARE_CLASS(QOpenGLShaderProgram)
17 
18 class GLWidget : public QOpenGLWidget, protected QOpenGLFunctions
19 {
20     Q_OBJECT
21 public:
22     GLWidget( const QColor &background);
23     ~GLWidget();
24 
25 public slots:
26     void loadAscllStl(QString filename, qreal ratio);
27 
28 protected:
29     void paintGL() override;
30     void initializeGL() override;
31 
32 private:
33     void paintFLLogo();
34     void createGeometry();
35 
36     qreal m_fAngle;
37     qreal m_fScale;
38     QVector<QVector3D> m_vertices;
39     QVector<QVector3D> m_normals;
40     int m_frames;
41     QTime m_time;
42     QOpenGLShader *m_vshader1;
43     QOpenGLShader *m_fshader1;
44     QOpenGLShaderProgram *m_program1;
45     QOpenGLBuffer m_vbo1;
46     int m_vertexAttr1;
47     int m_normalAttr1;
48     int m_matrixUniform1;
49     bool m_transparent;
50     QColor m_background;
51 };
52 
53 #endif
54