feat(EBO): add EBO config

This commit is contained in:
2025-11-15 19:56:08 +01:00
parent 789796732a
commit d257c2b827
2 changed files with 41 additions and 0 deletions

18
inc/EBO.hpp Executable file
View File

@@ -0,0 +1,18 @@
#ifndef EBO_HPP
#define EBO_HPP
#include <GL/glew.h>
class EBO
{
private:
GLuint id;
public:
EBO(const unsigned int* indices, size_t size);
~EBO();
void bind();
void unbind();
};
#endif

23
src/EBO.cpp Executable file
View 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);
}