#include "vertexArray.hpp"
#include <GL/glew.h>

namespace render {
namespace kernel {

VertexArray::VertexArray() noexcept
{
    glGenVertexArrays(1, &this->object);
    this->Bind();
}

VertexArray::~VertexArray() noexcept
{
    this->Unbind();
    glDeleteVertexArrays(1, &this->object);
}

void VertexArray::Bind() const noexcept
{
    glBindVertexArray(this->object);
}

void VertexArray::Unbind() const noexcept
{
    glBindVertexArray(0);
}

void VertexArray::Render(uint32_t mode, int32_t first, uint32_t count) const noexcept
{
    this->Bind();
    glDrawArrays(mode, first, count);
}

}
}
