feat(VBOs): rework vbo functions and add comments

This commit is contained in:
2026-01-07 13:46:01 +01:00
parent 92e190c1a4
commit a2804d3da2
2 changed files with 40 additions and 14 deletions

View File

@@ -5,19 +5,29 @@
#include "glad/glad.h"
// A VBO (Vertex Buffer Object) is a contiguous block of GPU memory that stores
// vertex data as raw bytes.
class VBO
{
private:
unsigned int id;
GLuint id; // OpenGL handle for this buffer
public:
VBO();
// VBO constructor
// It uploads raw vertex data into GPU memory (VRAM).
// The interpretation of this data is defined later by the VAO.
VBO(const void *data, size_t size);
// VBO destructor
// Deletes the GPU buffer when the VBO object goes out of scope. Frees the
// VRAM associated with this VBO.
~VBO();
void setData(const GLfloat* vertices, size_t size);
// Binds this VBO to the current GL_ARRAY_BUFFER target
void bind();
void unbind();
// unbinds current GL_ARRAY_BUFFER target (it's replaced by null id)
static void unbind();
};
#endif