mirror of
https://github.com/guezoloic/LearnOpenGL.git
synced 2026-01-25 13:34:16 +00:00
feat(p_cube.hpp): add vertice & indice length
This commit is contained in:
16
src/core/vbo.cpp
Executable file
16
src/core/vbo.cpp
Executable 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); }
|
||||
Reference in New Issue
Block a user