diff -r 34c6e7bc4ee1 -r c7241f504117 src/gl/gridprogram.h --- a/src/gl/gridprogram.h Sun Jun 12 23:59:37 2022 +0300 +++ b/src/gl/gridprogram.h Mon Jun 13 02:18:25 2022 +0300 @@ -20,23 +20,16 @@ #include "basicshaderprogram.h" #include "common.h" -class GridProgram : public AbstractBasicShaderProgram +class GridLayer final : public RenderLayer { - Q_OBJECT + BasicShader shader; + glm::vec4 gridColor = {1.0f, 1.0f, 1.0f, 0.75f}; + bool isInitialized = false; public: - GridProgram(QObject* parent = nullptr); void setGridMatrix(const glm::mat4& newGridMatrix); void setGridColor(const QColor& newGridColor); protected: - const char* vertexShaderSource() const override; - const char* fragmentShaderSource() const override; - const void* vertexData() const override; - int vertexSize() const override; - int vertexCount() const override; - void setupVertexArrays() override; - GLenum drawMode() const override; - QOpenGLBuffer::UsagePattern usagePattern() const override; -private: - glm::vec4 gridColor = {1.0f, 1.0f, 1.0f, 0.75f}; - std::vector gridData; + void initializeGL() override; + void paintGL() override; + void mvpMatrixChanged(const glm::mat4& mvpMatrix) override; };