---
title: "GLKMatrixStackCreate(_:)"
framework: GLKit
role: symbol
role_heading: Function
platforms: [iOS 5.0+, iPadOS 5.0+, macOS 10.8+, tvOS 9.0+]
path: "glkit/glkmatrixstackcreate(_:)"
---

# GLKMatrixStackCreate(_:)

Allocates and returns a new matrix stack.

## Declaration

```swift
func GLKMatrixStackCreate(_ alloc: CFAllocator?) -> Unmanaged<GLKMatrixStack>?
```

## Parameters

- `alloc`: The allocator to use to allocate the matrix stack.

## Return Value

Return Value A new matrix stack, or NULL if an error occurred.

## Discussion

Discussion A matrix stack is a Core Foundation type. Ownership follows The Create Rule in Memory Management Programming Guide for Core Foundation. A matrix stack is initialized with a single identity matrix on the top of the stack.

## See Also

### Functions

- [GLKMatrixStackGetMatrix2(_:)](glkit/glkmatrixstackgetmatrix2(_:).md)
- [GLKMatrixStackGetMatrix3(_:)](glkit/glkmatrixstackgetmatrix3(_:).md)
- [GLKMatrixStackGetMatrix3Inverse(_:)](glkit/glkmatrixstackgetmatrix3inverse(_:).md)
- [GLKMatrixStackGetMatrix3InverseTranspose(_:)](glkit/glkmatrixstackgetmatrix3inversetranspose(_:).md)
- [GLKMatrixStackGetMatrix4(_:)](glkit/glkmatrixstackgetmatrix4(_:).md)
- [GLKMatrixStackGetMatrix4Inverse(_:)](glkit/glkmatrixstackgetmatrix4inverse(_:).md)
- [GLKMatrixStackGetMatrix4InverseTranspose(_:)](glkit/glkmatrixstackgetmatrix4inversetranspose(_:).md)
- [GLKMatrixStackGetTypeID()](glkit/glkmatrixstackgettypeid().md)
- [GLKMatrixStackLoadMatrix4(_:_:)](glkit/glkmatrixstackloadmatrix4(_:_:).md)
- [GLKMatrixStackMultiplyMatrix4(_:_:)](glkit/glkmatrixstackmultiplymatrix4(_:_:).md)
- [GLKMatrixStackMultiplyMatrixStack(_:_:)](glkit/glkmatrixstackmultiplymatrixstack(_:_:).md)
- [GLKMatrixStackPop(_:)](glkit/glkmatrixstackpop(_:).md)
- [GLKMatrixStackPush(_:)](glkit/glkmatrixstackpush(_:).md)
- [GLKMatrixStackRotate(_:_:_:_:_:)](glkit/glkmatrixstackrotate(_:_:_:_:_:).md)
- [GLKMatrixStackRotateWithVector3(_:_:_:)](glkit/glkmatrixstackrotatewithvector3(_:_:_:).md)
