aboutsummaryrefslogtreecommitdiff
path: root/src/buffer/vertex/lattice_cell_buffer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer/vertex/lattice_cell_buffer.cc')
-rw-r--r--src/buffer/vertex/lattice_cell_buffer.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/buffer/vertex/lattice_cell_buffer.cc b/src/buffer/vertex/lattice_cell_buffer.cc
index c2b877b..ea4e103 100644
--- a/src/buffer/vertex/lattice_cell_buffer.cc
+++ b/src/buffer/vertex/lattice_cell_buffer.cc
@@ -1,19 +1,20 @@
#include "lattice_cell_buffer.h"
-#include <fstream>
+#include <vector>
-LatticeCellBuffer::LatticeCellBuffer(GLuint nX, GLuint nY):
- _data(9*nX*nY, GLfloat{1./9.}) {
+LatticeCellBuffer::LatticeCellBuffer(GLuint nX, GLuint nY) {
glGenVertexArrays(1, &_array);
glGenBuffers(1, &_buffer);
- const int inset = 0.4*nX;
+ std::vector<GLfloat> data(9*nX*nY, GLfloat{1./9.});
+ const int insetX = 0.45*nX;
+ const int insetY = 0.45*nY;
- for (int x = inset; x < nX-inset; x++) {
- for (int y = inset; y < nY-inset; y++) {
+ for (int x = insetX; x < nX-insetX; x++) {
+ for (int y = insetY; y < nY-insetY; y++) {
for ( int i = -1; i <= 1; ++i ) {
for ( int j = -1; j <= 1; ++j ) {
- _data[9*nX*y + 9*x + (i+1)*3 + j+1] = 1./64.;
+ data[9*nX*y + 9*x + (i+1)*3 + j+1] = 0.5;
}
}
}
@@ -23,8 +24,8 @@ LatticeCellBuffer::LatticeCellBuffer(GLuint nX, GLuint nY):
glBindBuffer(GL_ARRAY_BUFFER, _buffer);
glBufferData(
GL_ARRAY_BUFFER,
- _data.size() * sizeof(GLfloat),
- _data.data(),
+ data.size() * sizeof(GLfloat),
+ data.data(),
GL_DYNAMIC_DRAW
);