aboutsummaryrefslogtreecommitdiff
path: root/src/texture_display_buffer.h
diff options
context:
space:
mode:
authorAdrian Kummerlaender2018-05-23 19:06:47 +0200
committerAdrian Kummerlaender2018-05-23 19:06:47 +0200
commit84bcd409a3743e933d039a9b3e073030fd2630df (patch)
tree15724f48e5a516398ea097f8784873b1217e1d30 /src/texture_display_buffer.h
parent617fec827652d216e2d1e5015f816c4400655d73 (diff)
downloadcomputicle-84bcd409a3743e933d039a9b3e073030fd2630df.tar
computicle-84bcd409a3743e933d039a9b3e073030fd2630df.tar.gz
computicle-84bcd409a3743e933d039a9b3e073030fd2630df.tar.bz2
computicle-84bcd409a3743e933d039a9b3e073030fd2630df.tar.lz
computicle-84bcd409a3743e933d039a9b3e073030fd2630df.tar.xz
computicle-84bcd409a3743e933d039a9b3e073030fd2630df.tar.zst
computicle-84bcd409a3743e933d039a9b3e073030fd2630df.zip
Implement particle trails using overlaying textures
Diffstat (limited to 'src/texture_display_buffer.h')
-rw-r--r--src/texture_display_buffer.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/texture_display_buffer.h b/src/texture_display_buffer.h
index 530b99d..25fd319 100644
--- a/src/texture_display_buffer.h
+++ b/src/texture_display_buffer.h
@@ -6,12 +6,11 @@ class TextureDisplayBuffer {
private:
const std::vector<GLfloat> _data;
- GLuint _texture;
GLuint _array;
GLuint _buffer;
public:
- TextureDisplayBuffer(GLuint texture):
+ TextureDisplayBuffer():
_data{
-1.f, 1.f, 0.f, 1.f,
-1.f, -1.f, 0.f, 0.f,
@@ -20,8 +19,7 @@ public:
-1.f, 1.f, 0.f, 1.f,
1.f, -1.f, 1.f, 0.f,
1.f, 1.f, 1.f, 1.f
- },
- _texture(texture) {
+ } {
glGenVertexArrays(1, &_array);
glGenBuffers(1, &_buffer);
@@ -47,9 +45,14 @@ public:
glDeleteVertexArrays(1, &_array);
}
- void draw() const {
+ void draw(const std::vector<GLuint>& textures) const {
glBindVertexArray(_array);
- glBindTexture(GL_TEXTURE_2D, _texture);
+
+ for ( unsigned int i = 0; i < textures.size(); ++i ) {
+ glActiveTexture(GL_TEXTURE0+i);
+ glBindTexture(GL_TEXTURE_2D, textures[i]);
+ }
+
glDrawArrays(GL_TRIANGLES, 0, 6);
}