Instance Method

newTexture(data:options:)

Synchronously creates a new Metal texture from an in-memory representation of the texture's data.

Declaration

func newTexture(data: Data, options: [MTKTextureLoader.Option : Any]? = nil) throws -> MTLTexture

Parameters

data

The NSData object containing image data.

options

A dictionary describing any additional texture loading steps. See Texture Loading Options.

error

A pointer to an NSError object if an error occurred, or nil if the texture was fully loaded and initialized.

Return Value

A fully loaded and initialized Metal texture, or nil if an error occurred.

See Also

Loading Textures from In-Memory Data Representations

func newTexture(data: Data, options: [MTKTextureLoader.Option : Any]?, completionHandler: MTKTextureLoader.Callback)

Asynchronously creates a new Metal texture from an in-memory representation of the texture's data.