// // Created by lukas on 03.02.22. // #include "IndexBuffer.h" #include IndexBuffer::IndexBuffer(const unsigned *data, unsigned count): count(count) { glGenBuffers(1, &handle); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, handle); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(unsigned) * count , data, GL_STATIC_DRAW); } IndexBuffer::~IndexBuffer() { glDeleteBuffers(1, &handle); } void IndexBuffer::Bind() const { glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, handle); } void IndexBuffer::UnBind() const { glBindVertexArray(0); } unsigned IndexBuffer::getcount() const { return count; }