Struct VertexArray
Defined in File vertex-array-object.h
Inheritance Relationships
Base Type
public CE::Rendering::Geometry::Buffer2D(Struct Buffer2D)
Struct Documentation
-
struct VertexArray : public CE::Rendering::Geometry::Buffer2D
Declaration:
finalImmutable native vertex upload retaining its VAO and buffers.
2D ranges use vertex counts, not bytes. Indexed 3D construction is supported as native storage but reports Unsupported layout and rejects the 2D draw path. CPU upload views/owners are not retained after construction.
See also
Public Functions
Upload position3/UV2 vertices with fixed common attribute locations.
- Parameters:
lifetime – Required live owner/current-context native domain.
vertices – Nonempty contiguous CPU data within GLsizei/GLsizeiptr limits, borrowed until return.
topology – Triangles or TriangleStrip; no per-primitive completeness check is made until packet validation. Malformed input/topology throws invalid_args. Native/allocation failures retire completed adopted objects; construction may change native bindings and does not restore their prior values.
Upload position3/UV2/color4 vertices with fixed common attribute locations.
- Parameters:
lifetime – Required live owner/current-context native domain.
vertices – Nonempty contiguous CPU data within GLsizei/GLsizeiptr limits, borrowed until return.
topology – Triangles or TriangleStrip; no per-primitive completeness check is made until packet validation. Malformed input/topology throws invalid_args. Native/allocation failures retire completed adopted objects; construction may change native bindings and does not restore their prior values.
Compatibility upload retaining the CPU array only through the span constructor.
- Parameters:
lifetime – Required live native domain.
vertices – Owner of at least num_vertices contiguous vertices.
num_vertices – Nonzero count, not bytes.
topology – Uploaded triangle/strip interpretation. Null/empty input rejects; remaining size/native/failure behavior matches the position/UV span overload.
Copy an indexed 3D mesh into native vertex/element buffers.
- Parameters:
lifetime – Required live owner/current-context native domain.
vertices – Contiguous position/normal/UV array borrowed through upload.
num_vertices – Positive addressable vertex count.
indices – Contiguous unsigned index array borrowed through upload.
num_indices – Positive addressable index count. Null/empty/oversized buffers throw invalid_args; index contents are not bounds-validated here. The common 2D draw() path rejects meshes; construction retains no CPU owners and may change native bindings.
-
virtual void bind() const override
Bind this VAO after requiring its original live owner/current context; no program, image or material is selected.
-
virtual void draw(std::size_t first_vertex, std::size_t vertex_count) const override
Issue glDrawArrays for this flat upload’s topology after require_draw().
- Parameters:
first_vertex – First vertex index, not a byte offset.
vertex_count – Bounded vertex count representable by the uploaded native limits. Caller must bind this VAO and compatible program/material state first. This primitive does not bind it or enforce nonzero/complete primitives; pipeline playback does.
-
inline virtual ::CE::Rendering::Geometry::Layout2D vertex_layout() const noexcept override
Declaration:
[[nodiscard]]- Returns:
Uploaded flat layout or Unsupported for indexed mesh construction; CPU metadata only.
-
inline virtual ::CE::Rendering::Geometry::Topology topology() const noexcept override
Declaration:
[[nodiscard]]- Returns:
Uploaded topology metadata without native calls.
-
inline virtual std::size_t vertex_count() const noexcept override
Declaration:
[[nodiscard]]- Returns:
Uploaded vertex count, not bytes or mesh index count; CPU inspection only.
-
inline const ::CE::Rendering::OpenGL::ResourceLifetime *resource_domain() const noexcept
Declaration:
[[nodiscard]]- Returns:
Borrowed original native-domain identity while retaining this upload; no current/active validation occurs.
-
void require_draw(std::size_t first_vertex, std::size_t vertex_count) const
Validate live owner/current context, flat upload kind and bounded range without binding/drawing.
- Parameters:
first_vertex – First vertex index.
vertex_count – Range count; zero/primitive completeness is checked by common pipeline validation, not this low-level check. Mesh/range mismatch throws invalid_args; lifetime failures throw failed_operation.
Protected Types
Protected Attributes
-
::CE::Rendering::Geometry::Topology topology_ = ::CE::Rendering::Geometry::Topology::Triangles
Uploaded primitive interpretation.
-
::CE::Rendering::Geometry::Layout2D layout_ = ::CE::Rendering::Geometry::Layout2D::Position3UV2
Selected flat vertex layout; mesh reports Unsupported.
-
std::size_t vertex_count_ = 0
Number of uploaded vertices, independent of mesh index count.