diff options
author | Adrian Kummerlaender | 2018-12-17 19:08:50 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2018-12-17 19:08:50 +0100 |
commit | 85ad73153d1193e51e77ca825416df3794443fa4 (patch) | |
tree | f598f819fb4b7bbcd52e31aeab0b51c6eac3e31f /src/buffer | |
parent | dc69fab1565659241eb6f2f3576076872e86c45e (diff) | |
download | compustream-85ad73153d1193e51e77ca825416df3794443fa4.tar compustream-85ad73153d1193e51e77ca825416df3794443fa4.tar.gz compustream-85ad73153d1193e51e77ca825416df3794443fa4.tar.bz2 compustream-85ad73153d1193e51e77ca825416df3794443fa4.tar.lz compustream-85ad73153d1193e51e77ca825416df3794443fa4.tar.xz compustream-85ad73153d1193e51e77ca825416df3794443fa4.tar.zst compustream-85ad73153d1193e51e77ca825416df3794443fa4.zip |
Fix glDrawArray call
Diffstat (limited to 'src/buffer')
-rw-r--r-- | src/buffer/vertex/fluid_cell_buffer.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/buffer/vertex/fluid_cell_buffer.cc b/src/buffer/vertex/fluid_cell_buffer.cc index c602e0c..a0bfcc3 100644 --- a/src/buffer/vertex/fluid_cell_buffer.cc +++ b/src/buffer/vertex/fluid_cell_buffer.cc @@ -1,16 +1,20 @@ #include "fluid_cell_buffer.h" +#include <vector> + FluidCellBuffer::FluidCellBuffer(GLuint nX, GLuint nY): - _data(3*nX*nY, GLfloat{}) { + _nX(nX), _nY(nY) { glGenVertexArrays(1, &_array); glGenBuffers(1, &_buffer); glBindVertexArray(_array); glBindBuffer(GL_ARRAY_BUFFER, _buffer); + + const std::vector<GLfloat> data(3*nX*nY, GLfloat{}); glBufferData( GL_ARRAY_BUFFER, - _data.size() * sizeof(GLfloat), - _data.data(), + data.size() * sizeof(GLfloat), + data.data(), GL_DYNAMIC_DRAW ); @@ -29,5 +33,5 @@ GLuint FluidCellBuffer::getBuffer() const { void FluidCellBuffer::draw() const { glBindVertexArray(_array); - glDrawArrays(GL_POINTS, 0, _data.size()); + glDrawArrays(GL_POINTS, 0, _nX*_nY); } |