Sat, 05 Mar 2022 15:40:43 +0200
the grid now has less lines
src/gl/gridprogram.cpp | file | annotate | diff | comparison | revisions |
--- a/src/gl/gridprogram.cpp Sat Mar 05 13:59:54 2022 +0200 +++ b/src/gl/gridprogram.cpp Sat Mar 05 15:40:43 2022 +0200 @@ -18,7 +18,6 @@ #include "gridprogram.h" -// Based on https://stackoverflow.com/q/30842755 const char vertexShaderSource[] = R"( #version 330 core @@ -56,16 +55,17 @@ GridProgram::GridProgram(QObject *parent) : AbstractBasicShaderProgram{parent} { - this->gridData.reserve(8004); - for (int i = -1000; i < 1000; i += 1) + constexpr int extent = 50; + this->gridData.reserve(8 * extent + 4); + for (int i = -extent; i <= extent; i += 1) { - this->gridData.push_back({i, -1000}); - this->gridData.push_back({i, 1000}); + this->gridData.push_back({i, -extent}); + this->gridData.push_back({i, extent}); } - for (int i = -1000; i < 1000; i += 1) + for (int i = -extent; i <= extent; i += 1) { - this->gridData.push_back({-1000, i}); - this->gridData.push_back({1000, i}); + this->gridData.push_back({-extent, i}); + this->gridData.push_back({extent, i}); } }