<!--
{
  "availability" : [
    "macCatalyst: 13.1.0 -",
    "macOS: 10.2.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGOpenGLDisplayMaskToDisplayID(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Graphics"
    ],
    "preciseIdentifier" : "c:@F@CGOpenGLDisplayMaskToDisplayID"
  },
  "title" : "CGOpenGLDisplayMaskToDisplayID(_:)"
}
-->

# CGOpenGLDisplayMaskToDisplayID(_:)

Maps an OpenGL display mask to a display ID.

```
func CGOpenGLDisplayMaskToDisplayID(_ mask: CGOpenGLDisplayMask) -> CGDirectDisplayID
```

## Parameters

`mask`

The OpenGL display mask to be converted.

## Return Value

The display ID assigned to the specified display mask, or `kCGNullDirectDisplay` if no display matches the mask.

## Discussion

OpenGL sometimes identifies a display using a bitmask with one bit set. This function maps such a display mask to the corresponding display ID. If you pass in a mask with multiple bits set, this function returns a display ID matching one of these bits.

---

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)