54 index_buffer(std::span<const std::uint32_t> indices)
noexcept;
101 [[nodiscard]] constexpr auto
count() const -> std::int32_t;
108 [[nodiscard]] constexpr auto
id() const -> std::uint32_t;
116 : m_count {
static_cast<int32_t
>(indices.size()) }
118 glGenBuffers(1, &m_id);
119 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_id);
121 glBufferData(GL_ELEMENT_ARRAY_BUFFER,
122 static_cast<ptrdiff_t
>(indices.size_bytes()),
130 glDeleteBuffers(1, &
m_id);
135 : m_id { other.m_id }
136 , m_count { other.m_count }
143 if (
this != &other) {
145 m_count = other.m_count;
155 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,
m_id);
160 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
Element Buffer Object (EBO) wrapper.
index_buffer(const index_buffer &)=delete
constexpr auto count() const -> std::int32_t
Get the number of indices in the index buffer object.
void bind() const
Bind the index buffer object.
void unbind() const
Unbind the index buffer object.
auto operator=(const index_buffer &) -> index_buffer &=delete
~index_buffer()
Destroy the index buffer object.