30 lines
478 B
C
30 lines
478 B
C
#include "vbo.h"
|
|
|
|
void
|
|
vbo_init(VBO* self, GLint type, bool isDynamic)
|
|
{
|
|
self->isDynamic = isDynamic;
|
|
self->type = type;
|
|
|
|
glGenBuffers(1, &self->handle);
|
|
}
|
|
|
|
void
|
|
vbo_bind(VBO* self)
|
|
{
|
|
glBindBuffer(self->type, self->handle);
|
|
}
|
|
|
|
void
|
|
vbo_free(VBO* self)
|
|
{
|
|
glDeleteBuffers(1, &self->handle);
|
|
memset(self, '\0', sizeof(VBO));
|
|
}
|
|
|
|
void
|
|
vbo_buffer(VBO* self, size_t size, void* data)
|
|
{
|
|
glBufferData(self->type, size, data, self->isDynamic ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
|
|
}
|