29#include "engine_logger.hpp"
31using namespace brenta;
32using namespace brenta::types;
36 this->
target = input_target;
43 glBufferData(this->
target, size, data, usage);
48 if (this->
target != GL_ELEMENT_ARRAY_BUFFER)
51 glBufferData(this->
target, size, data, usage);
56 if (this->
target == GL_ELEMENT_ARRAY_BUFFER)
59 glBufferData(this->
target, size, data, usage);
66 ERROR(
"Buffer not initialized");
69 glBindBuffer(this->
target, this->
id);
74 glBindBuffer(this->
target, 0);
81 ERROR(
"Buffer not initialized");
84 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.