Element Buffer Object (EBO) wrapper.
More...
#include <index_buffer.hpp>
Element Buffer Object (EBO) wrapper.
Element Buffer Objects are OpenGL objects that store indices that OpenGL uses to render primitives, they can be bound to a VAO to specify the order in which to render the vertices contained in its VBOs.
EBOs are used to reduce the amount of data that needs to be sent to the GPU, by allowing the reuse of vertices.
- See also
- vertex_array
-
vertex_buffer
-
https://www.khronos.org/opengl/wiki/Vertex_Specification#Element_Buffer_Object
- Examples
- batches.cpp, sandbox.cpp, and teapot.cpp.
Definition at line 44 of file index_buffer.hpp.
◆ index_buffer() [1/4]
staplegl::index_buffer::index_buffer |
( |
| ) |
|
|
default |
◆ index_buffer() [2/4]
staplegl::index_buffer::index_buffer |
( |
std::span< const std::uint32_t > |
indices | ) |
|
|
inlinenoexcept |
Construct a new index buffer object.
- Parameters
-
indices | a pointer to the indices array, can be any contiguous container of std::uint32_t. |
count | the number of indices in the array. |
Definition at line 115 of file index_buffer.hpp.
◆ ~index_buffer()
staplegl::index_buffer::~index_buffer |
( |
| ) |
|
|
inline |
◆ index_buffer() [3/4]
staplegl::index_buffer::index_buffer |
( |
const index_buffer & |
| ) |
|
|
delete |
◆ index_buffer() [4/4]
staplegl::index_buffer::index_buffer |
( |
index_buffer && |
other | ) |
|
|
inlinenoexcept |
Construct a new index buffer object.
- Parameters
-
other | the other index buffer object to move from. |
Moving from an index buffer object is cheap, as it only involves copying the internal OpenGL ID, the other object is therefore left with an ID of 0.
Definition at line 134 of file index_buffer.hpp.
◆ bind()
void staplegl::index_buffer::bind |
( |
| ) |
const |
|
inline |
◆ count()
constexpr auto staplegl::index_buffer::count |
( |
| ) |
const -> std::int32_t |
|
constexpr |
Get the number of indices in the index buffer object.
- Returns
- std::int32_t, the number of indices.
Definition at line 163 of file index_buffer.hpp.
◆ id()
constexpr auto staplegl::index_buffer::id |
( |
| ) |
const -> std::uint32_t |
|
constexpr |
Get the ID of the index buffer object.
- Returns
- std::uint32_t the ID of the index buffer object.
◆ operator=() [1/2]
◆ operator=() [2/2]
Move assignment operator.
- Parameters
-
other | the other index buffer object to move from. |
- Returns
- index_buffer& The moved object.
Definition at line 141 of file index_buffer.hpp.
◆ unbind()
void staplegl::index_buffer::unbind |
( |
| ) |
const |
|
inline |
◆ m_count
std::int32_t staplegl::index_buffer::m_count {} |
|
private |
◆ m_id
std::uint32_t staplegl::index_buffer::m_id {} |
|
private |
The documentation for this class was generated from the following file: