Instance Method

newBufferFromZone:length:type:

Creates a new buffer of the specified length in the specified zone.

Required.

Declaration

- (id<MDLMeshBuffer>)newBufferFromZone:(id<MDLMeshBufferZone>)zone length:(NSUInteger)length type:(MDLMeshBufferType)type;

Parameters

zone

A pool of memory for related allocations, as returned by the newZone: method.

length

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

type

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

Return Value

A new memory buffer for mesh data.

Discussion

Use this method when making multiple related allocations that should share the same memory pool.

The concrete class implementing this protocol determines the initial contents of the buffer.

See Also

Allocating Mesh Buffers

- newZone:

Creates a zone for related memory allocations.

Required.

- newZoneForBuffersWithSize:andType:

Creates a zone large enough to fit the specified group of allocation sizes.

Required.

- newBuffer:type:

Creates a new buffer of the specified length.

Required.

- newBufferWithData:type:

Creates a new buffer containing the specified data.

Required.

- newBufferFromZone:data:type:

Creates a new buffer containing the specified data in the specified zone.

Required.