first commit
This commit is contained in:
29
src/engine/vbo.c
Normal file
29
src/engine/vbo.c
Normal file
@@ -0,0 +1,29 @@
|
||||
#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);
|
||||
}
|
Reference in New Issue
Block a user