Instance Method

newBufferWithData:type:

Creates a new buffer containing the specified data.

Required.

Declaration

- (id<MDLMeshBuffer>)newBufferWithData:(NSData *)data type:(MDLMeshBufferType)type;

Parameters

data

The initial data to store in the buffer. Implementations of this protocol typically copy this data.

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

The concrete class implementing this protocol determines 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 newBufferFromZone:data:type: method instead.

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.

- newBufferFromZone:length:type:

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

Required.

- newBufferFromZone:data:type:

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

Required.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software