aboutsummaryrefslogtreecommitdiff
path: root/src/buffer/vertex/particle_vertex_buffer.h
diff options
context:
space:
mode:
authorAdrian Kummerlaender2018-05-26 13:20:47 +0200
committerAdrian Kummerlaender2018-05-26 13:21:40 +0200
commit34052b51e00c939a35294d7085cadb5111484dd3 (patch)
tree03a5b1e350e47e2aa8551393ef67b2124ad50ddb /src/buffer/vertex/particle_vertex_buffer.h
parentf728e4c8d202de241673a13ce61570b6acb4bba7 (diff)
downloadcomputicle-34052b51e00c939a35294d7085cadb5111484dd3.tar
computicle-34052b51e00c939a35294d7085cadb5111484dd3.tar.gz
computicle-34052b51e00c939a35294d7085cadb5111484dd3.tar.bz2
computicle-34052b51e00c939a35294d7085cadb5111484dd3.tar.lz
computicle-34052b51e00c939a35294d7085cadb5111484dd3.tar.xz
computicle-34052b51e00c939a35294d7085cadb5111484dd3.tar.zst
computicle-34052b51e00c939a35294d7085cadb5111484dd3.zip
Separate headers into compilation units
Diffstat (limited to 'src/buffer/vertex/particle_vertex_buffer.h')
-rw-r--r--src/buffer/vertex/particle_vertex_buffer.h35
1 files changed, 6 insertions, 29 deletions
diff --git a/src/buffer/vertex/particle_vertex_buffer.h b/src/buffer/vertex/particle_vertex_buffer.h
index 25855a2..8fb96a4 100644
--- a/src/buffer/vertex/particle_vertex_buffer.h
+++ b/src/buffer/vertex/particle_vertex_buffer.h
@@ -2,6 +2,8 @@
#include <vector>
+#include <GL/glew.h>
+
class ParticleVertexBuffer {
private:
std::vector<GLfloat> _data;
@@ -10,35 +12,10 @@ private:
GLuint _buffer;
public:
- ParticleVertexBuffer(std::vector<GLfloat>&& data):
- _data{ std::move(data) } {
- glGenVertexArrays(1, &_array);
- glGenBuffers(1, &_buffer);
-
- glBindVertexArray(_array);
- glBindBuffer(GL_ARRAY_BUFFER, _buffer);
- glBufferData(
- GL_ARRAY_BUFFER,
- _data.size() * sizeof(GLfloat),
- _data.data(),
- GL_STATIC_DRAW
- );
-
- glEnableVertexAttribArray(0);
- glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
- }
-
- ~ParticleVertexBuffer() {
- glDeleteBuffers(1, &_buffer);
- glDeleteVertexArrays(1, &_array);
- }
+ ParticleVertexBuffer(std::vector<GLfloat>&& data);
+ ~ParticleVertexBuffer();
- void draw() const {
- glBindVertexArray(_array);
- glDrawArrays(GL_POINTS, 0, 3*_data.size());
- }
+ GLuint getBuffer() const;
- GLuint getBuffer() const {
- return _buffer;
- }
+ void draw() const;
};