diff --git a/vis/include/cgl/buffer.hpp b/vis/include/cgl/buffer.hpp index de18bc1..ad3226e 100644 --- a/vis/include/cgl/buffer.hpp +++ b/vis/include/cgl/buffer.hpp @@ -53,14 +53,20 @@ namespace cgl { glNamedBufferData(id, sizeof(T), &data, usage); } - void put(const std::vector &data, GLenum usage = GL_STATIC_DRAW) { - put(&data[0], data.size(), usage); - } - void put(const T *data, const size_t &size, GLenum usage = GL_STATIC_DRAW) { glNamedBufferData(id, sizeof(T) * size, data, usage); } + template + void put(const E &data, GLenum usage = GL_STATIC_DRAW) { + put(data.data(), data.size(), usage); + } + + template<> + void put>(const std::vector &data, GLenum usage = GL_STATIC_DRAW) { + put(data.data, data.size(), usage); + } + void bound(GLenum target, const std::function &action) const { glBindBuffer(target, id); action(); diff --git a/vis/include/rendering.hpp b/vis/include/rendering.hpp index 090238d..9fe87d4 100644 --- a/vis/include/rendering.hpp +++ b/vis/include/rendering.hpp @@ -44,8 +44,8 @@ public: template Slice(const tc::Group &g, T all_sg_gens, const std::vector> &exclude) : group(g) { - const Prims &data = merge(hull(g, all_sg_gens, exclude)); - ibo.put(data.data(), data.size()); + const auto &data = merge(hull(g, all_sg_gens, exclude)); + ibo.put(data); vao.ipointer(0, ibo, 4, GL_UNSIGNED_INT); }