mirror of
https://github.com/guezoloic/LearnOpenGL.git
synced 2026-01-25 04:34:14 +00:00
feat(VBO): add vbo config
This commit is contained in:
23
src/VBO.cpp
Executable file
23
src/VBO.cpp
Executable file
@@ -0,0 +1,23 @@
|
||||
#include "VBO.hpp"
|
||||
|
||||
VBO::VBO(GLfloat* vertices, size_t size)
|
||||
{
|
||||
glGenBuffers(1, &id);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, id);
|
||||
glBufferData(GL_ARRAY_BUFFER, size, vertices, GL_STATIC_DRAW);
|
||||
}
|
||||
|
||||
VBO::~VBO()
|
||||
{
|
||||
glDeleteBuffers(1, &id);
|
||||
}
|
||||
|
||||
void VBO::bind()
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, id);
|
||||
}
|
||||
|
||||
void VBO::unbind()
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
Reference in New Issue
Block a user