first commit

This commit is contained in:
2024-04-11 01:05:03 -04:00
commit 3398c52f8b
272 changed files with 35195 additions and 0 deletions

29
src/engine/vbo.c Normal file
View 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);
}