---
title: "texelDataWithTopLeftOrigin(atMipLevel:create:)"
framework: modelio
role: symbol
role_heading: Instance Method
path: "modelio/mdltexture/texeldatawithtopleftorigin(atmiplevel:create:)"
---

# texelDataWithTopLeftOrigin(atMipLevel:create:)

Returns the texture’s image data for the specified mipmap level, organized such that its first pixel represents the top-left corner of the image.

## Declaration

```swift
func texelDataWithTopLeftOrigin(atMipLevel level: Int, create: Bool) -> Data?
```

## Parameters

- `level`: The mipmap level for which to access image data.
- `create`: If doc://com.apple.documentation/documentation/Swift/true and the texture does not contain image data for the specified mipmap level (that is, the level parameter is greater than the texture’s doc://com.apple.modelio/documentation/ModelIO/MDLTexture/mipLevelCount value) Model I/O generates image data for that mipmap level. If doc://com.apple.documentation/documentation/Swift/false, this method returns nil for mipmap levels where no image data exists.

## Return Value

Return Value The texture’s image data, or nil if data is not available.

## Discussion

Discussion Mipmapping is a technique that uses multiple sizes of a texture image to increase rendering performance. The image for mipmap level zero matches the size in the dimensions property. Mipmap level 1 is an image at half the original dimensions; level 2 is at quarter size; and so on. If the texture was initialized with image data in bottom-left-origin format, the first call to this method creates and caches image data in top-left-origin format. This method returns nil if the texture was not initialized with image data and is not a MDLTexture subclass capable of loading or generating its own data.

## See Also

### Accessing Texture Data

- [texelDataWithTopLeftOrigin()](modelio/mdltexture/texeldatawithtopleftorigin().md)
- [texelDataWithBottomLeftOrigin()](modelio/mdltexture/texeldatawithbottomleftorigin().md)
- [texelDataWithBottomLeftOrigin(atMipLevel:create:)](modelio/mdltexture/texeldatawithbottomleftorigin(atmiplevel:create:).md)
