diff -r 910890292639 -r 9f435f66bd0c src/gl/gridprogram.cpp --- a/src/gl/gridprogram.cpp Fri Feb 05 14:23:16 2021 +0200 +++ b/src/gl/gridprogram.cpp Wed Feb 17 16:49:35 2021 +0200 @@ -63,6 +63,10 @@ )"; static const glm::vec2 data[] = {{-1, -1}, {-1, 1}, {1, 1}, {1, -1}}; +constexpr std::size_t vertexSize = sizeof data[0]; + +GridProgram::GridProgram(QObject* parent) : + AbstractShaderProgram{{{GL_QUADS, vertexSize}}, parent} void GridProgram::setGridMatrix(const glm::mat4& newGridMatrix) { @@ -95,29 +99,11 @@ return ::fragmentShaderSource; } -const void* GridProgram::vertexData() const -{ - return ::data; -} - -int GridProgram::vertexSize() const -{ - return sizeof data[0]; -} - -int GridProgram::vertexCount() const -{ - return glm::countof(data); -} - void GridProgram::setupVertexArrays() { this->program->enableAttributeArray(0); this->program->setAttributeBuffer(0, GL_FLOAT, 0, 2, 0); this->program->setUniformVector("gridColor", this->gridColor); + this->upload(&this->arrays[0], ::data, countof(data)); } -GLenum GridProgram::drawMode() const -{ - return GL_QUADS; -}