nCine::Geometry class

Contains the vertex and index buffer data for a drawable node.

Owns (or shares) the vertex buffer object and optional index buffer object that back a single render command, together with the draw parameters (primitive type, first vertex, vertex/index counts). Vertex and index data can either be supplied through host pointers or written directly into mapped buffer memory acquired from the RenderBuffersManager.

Constructors, destructors, conversion operators

Geometry()
~Geometry()
Geometry(const Geometry&) deleted

Public functions

auto operator=(const Geometry&) -> Geometry& deleted
auto GetPrimitiveType() const -> GLenum
Returns the primitive type (GL_TRIANGLES, GL_TRIANGLE_STRIP, ...).
auto GetFirstVertex() const -> GLint
Returns the index of the first vertex to draw.
auto GetVertexCount() const -> GLsizei
Returns the number of vertices.
auto GetElementsPerVertex() const -> std::uint32_t
Returns the number of float elements that compose the vertex format.
void SetDrawParameters(GLenum primitiveType, GLint firstVertex, GLsizei numVertices)
Sets all three drawing parameters at once.
void SetPrimitiveType(GLenum primitiveType)
Sets the primitive type (GL_TRIANGLES, GL_TRIANGLE_STRIP, ...).
void SetFirstVertex(GLint firstVertex)
Sets the index of the first vertex to draw.
void SetVertexCount(GLsizei numVertices)
Sets the number of vertices.
void SetElementsPerVertex(std::uint32_t numElements)
Sets the number of float elements that compose the vertex format.
void CreateCustomVbo(std::uint32_t numFloats, GLenum usage)
Creates a custom VBO that is unique to this object.
auto AcquireVertexPointer(std::uint32_t numFloats, std::uint32_t numFloatsAlignment) -> GLfloat*
Acquires a pointer for writing vertex data into a custom VBO owned by this object.
auto AcquireVertexPointer(std::uint32_t numFloats) -> GLfloat*
Acquires a pointer for writing vertex data into a custom VBO owned by this object.
auto AcquireVertexPointer() -> GLfloat*
Acquires a pointer for writing vertex data into a VBO owned by the buffers manager.
void ReleaseVertexPointer()
Releases the pointer used to write vertex data.
auto GetHostVertexPointer() const -> const float*
Returns a pointer into host memory containing vertex data to be copied into a VBO.
void SetHostVertexPointer(const float* vertexPointer)
Sets a pointer into host memory containing vertex data to be copied into a VBO.
void ShareVbo(const Geometry* geometry)
Shares the VBO of another object.
auto GetIndexCount() const -> std::uint32_t
Returns the number of indices used to render the geometry.
void SetFirstIndex(GLushort firstIndex)
Sets the index of the first index to draw.
void SetIndexCount(std::uint32_t numIndices)
Sets the number of indices used to render the geometry.
void CreateCustomIbo(std::uint32_t numIndices, GLenum usage)
Creates a custom IBO that is unique to this object.
auto AcquireIndexPointer(std::uint32_t numIndices) -> GLushort*
Acquires a pointer for writing index data into a custom IBO owned by this object.
auto AcquireIndexPointer() -> GLushort*
Acquires a pointer for writing index data into an IBO owned by the buffers manager.
void ReleaseIndexPointer()
Releases the pointer used to write index data.
auto GetHostIndexPointer() const -> const GLushort*
Returns a pointer into host memory containing index data to be copied into an IBO.
void SetHostIndexPointer(const GLushort* indexPointer)
Sets a pointer into host memory containing index data to be copied into an IBO.
void ShareIbo(const Geometry* geometry)
Shares the IBO of another object.

Function documentation

GLfloat* nCine::Geometry::AcquireVertexPointer(std::uint32_t numFloats, std::uint32_t numFloatsAlignment)

Acquires a pointer for writing vertex data into a custom VBO owned by this object.

Parameters
numFloats Number of floats to be written
numFloatsAlignment Alignment in floats

This overload allows a custom alignment to be specified.