29#include "engine_logger.hpp"
31using namespace Brenta::Types;
32using namespace Brenta::Utils;
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 Bind()
Bind the buffer object.
GLenum GetTarget()
Get the buffer object target.
GLenum target
Buffer object target (like GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER...)
void SetTarget(GLenum target)
Set the buffer object target.
Buffer()
Default constructor, does nothing.
int GetId()
Get the buffer object id.
void CopyData(GLsizeiptr size, const void *data, GLenum usage)
Copy data to the buffer object.
void Delete()
Delete the buffer object.
void Unbind()
Unbind the buffer object.
void CopyIndices(GLsizeiptr size, const void *data, GLenum usage)
Copy data to the buffer object.
unsigned int id
Buffer object id, generated by OpenGL.
void CopyVertices(GLsizeiptr size, const void *data, GLenum usage)
Copy data to the buffer object.
void SetId(unsigned int id)
Set the buffer object id.