6#include <brenta/buffer.hpp>
7#include <brenta/logger.hpp>
10using namespace brenta::types;
14 this->
target = input_target;
20 glBufferData(this->
target, size, data, usage);
25 if (this->
target != GL_ELEMENT_ARRAY_BUFFER)
28 glBufferData(this->
target, size, data, usage);
33 if (this->
target == GL_ELEMENT_ARRAY_BUFFER)
36 glBufferData(this->
target, size, data, usage);
43 ERROR(
"buffer::bind: not initialized");
46 glBindBuffer(this->
target, this->
id);
51 glBindBuffer(this->
target, 0);
58 ERROR(
"buffer::destroy: not initialized");
61 glDeleteBuffers(1, &this->
id);
void copy_indices(GLsizeiptr size, const void *data, GLenum usage)
Copy data to the buffer object.
void unbind()
Unbind the buffer object.
void set_target(GLenum target)
Set the buffer object target.
void destroy()
Delete the buffer object.
void set_id(unsigned int id)
Set the buffer object id.
void copy_vertices(GLsizeiptr size, const void *data, GLenum usage)
Copy data to the buffer object.
void copy_data(GLsizeiptr size, const void *data, GLenum usage)
Copy data to the buffer object.
GLenum get_target()
Get the buffer object target.
buffer()
Default constructor, does nothing.
unsigned int id
Buffer object id, generated by OpenGL.
GLenum target
Buffer object target (like GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER...)
int get_id()
Get the buffer object id.
void bind()
Bind the buffer object.