feat(p_cube.hpp): add vertice & indice length

This commit is contained in:
2026-01-06 22:13:09 +01:00
parent cc956449c7
commit 92e190c1a4
11 changed files with 175 additions and 169 deletions

16
src/core/vbo.cpp Executable file
View File

@@ -0,0 +1,16 @@
#include "vbo.hpp"
VBO::VBO() : id(0) {}
void VBO::setData(const GLfloat* vertices, size_t size)
{
if (this->id == 0) glGenBuffers(1, &this->id);
glBindBuffer(GL_ARRAY_BUFFER, this->id);
glBufferData(GL_ARRAY_BUFFER, size, vertices, GL_STATIC_DRAW);
}
VBO::~VBO() { glDeleteBuffers(1, &this->id); }
void VBO::bind() { glBindBuffer(GL_ARRAY_BUFFER, this->id); }
void VBO::unbind() { glBindBuffer(GL_ARRAY_BUFFER, 0); }