<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ModelIO",
  "identifier" : "/documentation/ModelIO/MDLVoxelArray/mesh(using:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Model I/O"
    ],
    "preciseIdentifier" : "c:objc(cs)MDLVoxelArray(im)meshUsingAllocator:"
  },
  "title" : "mesh(using:)"
}
-->

# mesh(using:)

Generates a closed polygon mesh around the volume of space the voxel array describes.

```
func mesh(using allocator: (any MDLMeshBufferAllocator)?) -> MDLMesh?
```

## Parameters

`allocator`

An object responsible for allocating mesh vertex data. If `nil`, Model I/O uses an internal allocator object.

## Return Value

A new mesh object.

## Discussion

Use this method to create a polygon mesh for use in rendering the object described by the voxel array.

The `allocator` parameter controls vertex data allocation for the mesh. For example, to use the MetalKit framework for loading vertex data into GPU buffers for rendering using Metal, pass a <doc://com.apple.documentation/documentation/MetalKit/MTKMeshBufferAllocator> object. By specifying an allocator, you can ensure that mesh data is copied a minimal number of times between being generated and being loaded into GPU memory for rendering.

---

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)