]> git.sesse.net Git - nageru/blob - glwidget.h
Unify video-to-video and video-to-picture fade chains.
[nageru] / glwidget.h
1 #ifndef GLWIDGET_H
2 #define GLWIDGET_H
3
4 #include <epoxy/gl.h>
5 #include <QGLWidget>
6 #include <string>
7 #include <vector>
8
9 #include "mixer.h"
10 #include "qgl.h"
11 #include "qobjectdefs.h"
12
13 class QMouseEvent;
14 class QWidget;
15
16 // Note: We use the older QGLWidget instead of QOpenGLWidget as it is
17 // much faster (does not go through a separate offscreen rendering step).
18 //
19 // TODO: Consider if QOpenGLWindow could do what we want.
20 class GLWidget : public QGLWidget
21 {
22         Q_OBJECT
23
24 public:
25         GLWidget(QWidget *parent = 0);
26         ~GLWidget();
27
28         void set_output(Mixer::Output output)
29         {
30                 this->output = output;
31         }
32
33 protected:
34         void initializeGL() override;
35         void resizeGL(int width, int height) override;
36         void paintGL() override;
37         void mousePressEvent(QMouseEvent *event) override;
38
39 signals:
40         void clicked();
41         void transition_names_updated(std::vector<std::string> transition_names);
42
43 private:
44         Mixer::Output output;
45         GLuint vao, program_num;
46         GLuint position_vbo, texcoord_vbo;
47 };
48
49 #endif