#include "cbt/opengl/vao.hpp" namespace cbt::opengl { vao::vao() { glGenVertexArrays(1, &m_id); } vao::~vao() { if (m_id) { glDeleteVertexArrays(1, &m_id); } } vao::vao(vao&& other) noexcept : m_id(other.m_id) { other.m_id = 0; } vao& vao::operator=(vao&& other) noexcept { if (this != &other) { if (m_id) { glDeleteVertexArrays(1, &m_id); } m_id = other.m_id; other.m_id = 0; } return *this; } auto vao::bind() const -> void { glBindVertexArray(m_id); } auto vao::unbind() const -> void { glBindVertexArray(0); } auto vao::id() const -> GLuint { return m_id; } auto vao::valid() const -> bool { return m_id != 0; } }