---
title: "cubeMap(withContentsOfFiles:options:)"
framework: glkit
role: symbol
role_heading: Type Method
path: "glkit/glktextureloader/cubemap(withcontentsoffiles:options:)"
---

# cubeMap(withContentsOfFiles:options:)

Loads a cube map texture image from a series of files and creates a new texture from the data.

## Declaration

```swift
class func cubeMap(withContentsOfFiles paths: [Any], options: [String : NSNumber]? = nil) throws -> GLKTextureInfo
```

## Parameters

- `paths`: An array of doc://com.apple.documentation/documentation/Foundation/URL or String objects that provide the paths to the six files that make up the cube map.
- `options`: A dictionary that describes any additional steps you want the texture loader to take when loading the texture. See doc://com.apple.glkit/documentation/GLKit/texture-loading-options.

## Return Value

Return Value A texture info object that describes the loaded texture or nil if an error occurred.

## Discussion

Discussion The array of file paths must include six entries for the six faces of the cube map. The URLs should be arranged in the following order: Right(+x), Left(-x), Top(+y), Bottom(-y), Front(+z), Back(-z). This coordinate system is left-handed if you think of yourself within the cube. The coordinate system is right-handed if you think of yourself outside of the cube. This class method loads the texture into the sharegroup attached to the current context for the thread this method is called on. note: In Swift, this method returns a nonoptional result and is marked with the throws keyword to indicate that it throws an error in cases of failure. You call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in Error Handling in The Swift Programming Language and About Imported Cocoa Error Parameters.

## Topics

### Related Documentation

- [cubeMap(withContentsOf:options:queue:completionHandler:)](glkit/glktextureloader/cubemap(withcontentsof:options:queue:completionhandler:).md)

## See Also

### Loading Cube Maps from Files

- [cubeMap(withContentsOfFile:options:)](glkit/glktextureloader/cubemap(withcontentsoffile:options:).md)
- [cubeMap(withContentsOfFile:options:queue:completionHandler:)](glkit/glktextureloader/cubemap(withcontentsoffile:options:queue:completionhandler:).md)
- [cubeMap(withContentsOfFiles:options:queue:completionHandler:)](glkit/glktextureloader/cubemap(withcontentsoffiles:options:queue:completionhandler:).md)
