diff options
Diffstat (limited to 'engine-ocean/Graphics/GLWrappers/vbo.cpp')
-rw-r--r-- | engine-ocean/Graphics/GLWrappers/vbo.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/engine-ocean/Graphics/GLWrappers/vbo.cpp b/engine-ocean/Graphics/GLWrappers/vbo.cpp new file mode 100644 index 0000000..a8d08fb --- /dev/null +++ b/engine-ocean/Graphics/GLWrappers/vbo.cpp @@ -0,0 +1,27 @@ +#include "vbo.h" +#include <iostream> + +VBO::VBO(std::vector<float> data): + m_length(data.size()) +{ + glGenBuffers(1, &m_handle); + bind(); + glBufferData(GL_ARRAY_BUFFER, m_length*sizeof(float), data.data(), GL_STATIC_DRAW); + unbind(); +} + +VBO::~VBO(){ + glDeleteBuffers(1, &m_handle); +} + +void VBO::bind(){ + glBindBuffer(GL_ARRAY_BUFFER, m_handle); +} + +void VBO::unbind(){ + glBindBuffer(GL_ARRAY_BUFFER, 0); +} + +GLsizei VBO::getLength(){ + return m_length; +}
\ No newline at end of file |