---
title: MDLTexture
framework: modelio
role: symbol
role_heading: Class
path: modelio/mdltexture
---

# MDLTexture

A source of texel data to be used in rendering material surface appearances.

## Declaration

```swift
class MDLTexture
```

## Overview

Overview You use the MDLTexture class or one of its subclasses to identify, load, or create texture data, and then associate textures with materials using the MDLTextureSampler and MDLMaterialProperty classes. When you load 3D objects from an asset file (in a format that supports texturing) with the MDLAsset class, Model I/O automatically creates texture objects and material objects and associates them with the MDLSubmesh objects in the asset.

## Topics

### Loading Textures from a Bundle

- [init(named:)](modelio/mdltexture/init(named:).md)
- [init(named:bundle:)](modelio/mdltexture/init(named:bundle:).md)
- [init(cubeWithImagesNamed:)](modelio/mdltexture/init(cubewithimagesnamed:).md)
- [init(cubeWithImagesNamed:bundle:)](modelio/mdltexture/init(cubewithimagesnamed:bundle:).md)

### Creating Textures

- [init(data:topLeftOrigin:name:dimensions:rowStride:channelCount:channelEncoding:isCube:)](modelio/mdltexture/init(data:topleftorigin:name:dimensions:rowstride:channelcount:channelencoding:iscube:).md)

### Exporting Textures

- [write(to:)](modelio/mdltexture/write(to:).md)
- [write(to:type:)](modelio/mdltexture/write(to:type:).md)
- [imageFromTexture()](modelio/mdltexture/imagefromtexture().md)

### Accessing Texture Data

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

### Examining Texture Attributes

- [dimensions](modelio/mdltexture/dimensions.md)
- [rowStride](modelio/mdltexture/rowstride.md)
- [channelCount](modelio/mdltexture/channelcount.md)
- [channelEncoding](modelio/mdltexture/channelencoding.md)
- [isCube](modelio/mdltexture/iscube.md)
- [mipLevelCount](modelio/mdltexture/miplevelcount.md)

### Creating Irradiance Textures

- [irradianceTextureCube(with:name:dimensions:)](modelio/mdltexture/irradiancetexturecube(with:name:dimensions:).md)
- [irradianceTextureCube(with:name:dimensions:roughness:)](modelio/mdltexture/irradiancetexturecube(with:name:dimensions:roughness:).md)

### Constants

- [MDLTextureChannelEncoding](modelio/mdltexturechannelencoding.md)

### Initializers

- [init()](modelio/mdltexture/init().md)
- [init(named:assetResolver:)](modelio/mdltexture/init(named:assetresolver:).md)

### Instance Properties

- [hasAlphaValues](modelio/mdltexture/hasalphavalues.md)

### Instance Methods

- [imageFromTexture(atLevel:)](modelio/mdltexture/imagefromtexture(atlevel:).md)
- [write(to:level:)](modelio/mdltexture/write(to:level:).md)
- [write(to:type:level:)](modelio/mdltexture/write(to:type:level:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Inherited By

- [MDLCheckerboardTexture](modelio/mdlcheckerboardtexture.md)
- [MDLColorSwatchTexture](modelio/mdlcolorswatchtexture.md)
- [MDLNoiseTexture](modelio/mdlnoisetexture.md)
- [MDLNormalMapTexture](modelio/mdlnormalmaptexture.md)
- [MDLSkyCubeTexture](modelio/mdlskycubetexture.md)
- [MDLURLTexture](modelio/mdlurltexture.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [MDLNamed](modelio/mdlnamed.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Textures

- [MDLCheckerboardTexture](modelio/mdlcheckerboardtexture.md)
- [MDLColorSwatchTexture](modelio/mdlcolorswatchtexture.md)
- [MDLNoiseTexture](modelio/mdlnoisetexture.md)
- [MDLNormalMapTexture](modelio/mdlnormalmaptexture.md)
- [MDLSkyCubeTexture](modelio/mdlskycubetexture.md)
- [MDLURLTexture](modelio/mdlurltexture.md)
- [MDLTextureFilter](modelio/mdltexturefilter.md)
- [MDLTextureSampler](modelio/mdltexturesampler.md)
