diff options
author | ccolin | 2021-01-03 12:30:16 +0100 |
---|---|---|
committer | ccolin | 2021-01-03 12:30:16 +0100 |
commit | 928d45c3fbfb6b00d8e0b79b63934ebd080b9456 (patch) | |
tree | 9e6b4f457d3c3130aa57b183f868e378e9810f5a /src/opengl_widget.hh | |
parent | 8ad1cf1b89b8acae55e36d6bd4562dffd1bcc714 (diff) |
refactor drawing code
Diffstat (limited to 'src/opengl_widget.hh')
-rw-r--r-- | src/opengl_widget.hh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/opengl_widget.hh b/src/opengl_widget.hh index 785a17f..1bc2bbc 100644 --- a/src/opengl_widget.hh +++ b/src/opengl_widget.hh @@ -13,6 +13,12 @@ #define FOV 70 +class Painter { +public: + virtual void draw(QOpenGLExtraFunctions *f) const = 0; +}; + + class OpenGLWidget : public QOpenGLWidget, public QOpenGLExtraFunctions { Q_OBJECT @@ -25,8 +31,12 @@ class OpenGLWidget : public QOpenGLWidget, public QOpenGLExtraFunctions { GLuint skybox_tex; GLuint skybox_vao; GLuint skybox_vbo; + OpenGLMesh *ground; void loadSkybox(); + void loadGround(); + + const Painter *painter = nullptr; protected: virtual void mousePressEvent(QMouseEvent *e); @@ -44,6 +54,8 @@ public: void initializeGL() override; void resizeGL(int w, int h) override; void paintGL() override; + void setPainter(const Painter *p); + QOpenGLShaderProgram *getMainProgram(); signals: void initialized(); |