Contents

newBuffer(_:type:)

Creates a new buffer of the specified length.

Declaration

func newBuffer(_ length: Int, type: MDLMeshBufferType) -> any MDLMeshBuffer

Parameters

  • length:

    The size, in bytes, of the buffer to create.

  • type:

    Use Vertex to create a buffer for a mesh’s vertex attribute data, or Index to create a buffer for a submesh’s index data.

Return Value

A new memory buffer for mesh data.

Discussion

The concrete class implementing this protocol determines the initial contents of the buffer and the memory pool from which the buffer is allocated. To provide a hint that multiple related allocations should share the same pool of memory, use the newBuffer(from:length:type:) method instead.

See Also

Allocating Mesh Buffers