aboutsummaryrefslogtreecommitdiff
path: root/src/buffer/vertex
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer/vertex')
-rw-r--r--src/buffer/vertex/fluid_cell_buffer.cc4
-rw-r--r--src/buffer/vertex/fluid_cell_buffer.h2
-rw-r--r--src/buffer/vertex/lattice_cell_buffer.cc12
-rw-r--r--src/buffer/vertex/lattice_cell_buffer.h2
4 files changed, 11 insertions, 9 deletions
diff --git a/src/buffer/vertex/fluid_cell_buffer.cc b/src/buffer/vertex/fluid_cell_buffer.cc
index 5056569..c602e0c 100644
--- a/src/buffer/vertex/fluid_cell_buffer.cc
+++ b/src/buffer/vertex/fluid_cell_buffer.cc
@@ -1,7 +1,7 @@
#include "fluid_cell_buffer.h"
-FluidCellBuffer::FluidCellBuffer():
- _data(3*128*128, GLfloat{}) {
+FluidCellBuffer::FluidCellBuffer(GLuint nX, GLuint nY):
+ _data(3*nX*nY, GLfloat{}) {
glGenVertexArrays(1, &_array);
glGenBuffers(1, &_buffer);
diff --git a/src/buffer/vertex/fluid_cell_buffer.h b/src/buffer/vertex/fluid_cell_buffer.h
index b2b880a..f71c2cb 100644
--- a/src/buffer/vertex/fluid_cell_buffer.h
+++ b/src/buffer/vertex/fluid_cell_buffer.h
@@ -12,7 +12,7 @@ private:
GLuint _buffer;
public:
- FluidCellBuffer();
+ FluidCellBuffer(GLuint nX, GLuint nY);
~FluidCellBuffer();
GLuint getBuffer() const;
diff --git a/src/buffer/vertex/lattice_cell_buffer.cc b/src/buffer/vertex/lattice_cell_buffer.cc
index 7fb51d8..c2b877b 100644
--- a/src/buffer/vertex/lattice_cell_buffer.cc
+++ b/src/buffer/vertex/lattice_cell_buffer.cc
@@ -2,16 +2,18 @@
#include <fstream>
-LatticeCellBuffer::LatticeCellBuffer():
- _data(9*128*128, GLfloat{1./9.}) {
+LatticeCellBuffer::LatticeCellBuffer(GLuint nX, GLuint nY):
+ _data(9*nX*nY, GLfloat{1./9.}) {
glGenVertexArrays(1, &_array);
glGenBuffers(1, &_buffer);
- for (int x = 50; x < 128-50; x++) {
- for (int y = 50; y < 128-50; y++) {
+ const int inset = 0.4*nX;
+
+ for (int x = inset; x < nX-inset; x++) {
+ for (int y = inset; y < nY-inset; y++) {
for ( int i = -1; i <= 1; ++i ) {
for ( int j = -1; j <= 1; ++j ) {
- _data[9*128*y + 9*x + (i+1)*3 + j+1] = 1./128.;
+ _data[9*nX*y + 9*x + (i+1)*3 + j+1] = 1./64.;
}
}
}
diff --git a/src/buffer/vertex/lattice_cell_buffer.h b/src/buffer/vertex/lattice_cell_buffer.h
index c28319e..f6638c8 100644
--- a/src/buffer/vertex/lattice_cell_buffer.h
+++ b/src/buffer/vertex/lattice_cell_buffer.h
@@ -12,7 +12,7 @@ private:
GLuint _buffer;
public:
- LatticeCellBuffer();
+ LatticeCellBuffer(GLuint nX, GLuint nY);
~LatticeCellBuffer();
GLuint getBuffer() const;