nCine::RHI::GL::GLVertexFormat class

Describes the format of a vertex.

Collects all the state that specifies the format of a vertex: a set of Attribute entries (each describing a component count, type, normalization, stride, offset and source VBO) plus an optional index buffer. Define() applies the format to the currently bound program and VAO by issuing the vertex attribute pointer calls, while Reset() disables all attributes.

Public types

class Attribute
A single vertex attribute within a vertex format.

Public static variables

static std::uint32_t MaxAttributes constexpr
The minimum guaranteed value for GL_MAX_VERTEX_ATTRIBS.

Constructors, destructors, conversion operators

GLVertexFormat()
GLVertexFormat(const GLVertexFormat& other) defaulted

Public functions

auto operator=(const GLVertexFormat& other) -> GLVertexFormat& defaulted
auto GetAttributeCount() const -> std::uint32_t
Returns the number of attributes in the format.
auto GetIbo() const -> const GLBufferObject*
Returns the index buffer object, or nullptr if none.
void SetIbo(const GLBufferObject* ibo)
Sets the index buffer object.
void Define()
Applies the vertex format to the currently bound program and VAO.
void Reset()
Disables all attributes and clears the index buffer.
auto CalculateFingerprint() const -> std::uint64_t
Calculates a hash of the format for fast inequality checks.
auto operator[](std::uint32_t index) -> Attribute&
Returns the attribute at the given index.
auto operator[](std::uint32_t index) const -> const Attribute&
Returns the attribute at the given index.
auto operator==(const GLVertexFormat& other) const -> bool
auto operator!=(const GLVertexFormat& other) const -> bool

Function documentation

std::uint64_t nCine::RHI::GL::GLVertexFormat::CalculateFingerprint() const

Calculates a hash of the format for fast inequality checks.

Formats that compare equal have equal fingerprints, so a fingerprint mismatch proves inequality, while a match still has to be confirmed with operator==().