<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macOS: 10.8.0 -",
    "tvOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GLKit",
  "identifier" : "/documentation/GLKit/GLKMatrixStackCreate(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "GLKit"
    ],
    "preciseIdentifier" : "c:@F@GLKMatrixStackCreate"
  },
  "title" : "GLKMatrixStackCreate(_:)"
}
-->

# GLKMatrixStackCreate(_:)

Allocates and returns a new matrix stack.

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

## Parameters

`alloc`

The allocator to use to allocate the matrix stack.

## Return Value

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

## Discussion

A matrix stack is a Core Foundation type. Ownership follows [The Create Rule](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html#//apple_ref/doc/uid/20001148-103029) in [Memory Management Programming Guide for Core Foundation](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/CFMemoryMgmt.html#//apple_ref/doc/uid/10000127i).

A matrix stack is initialized with a single identity matrix on the top of the stack.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)