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