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

# CGGetDisplaysWithOpenGLDisplayMask(_:_:_:_:)

Provides a list of displays that corresponds to the bits set in an OpenGL display mask.

```
func CGGetDisplaysWithOpenGLDisplayMask(_ mask: CGOpenGLDisplayMask, _ maxDisplays: UInt32, _ displays: UnsafeMutablePointer<CGDirectDisplayID>?, _ matchingDisplayCount: UnsafeMutablePointer<UInt32>?) -> CGError
```

## Parameters

`mask`

An OpenGL display mask that identifies one or more displays.

`maxDisplays`

The size of the `displays` array. This value determines the maximum number of displays the list includes.

`displays`

A pointer to storage you provide for an array of display IDs. On return, the array contains a list of displays that corresponds to the bits set in the mask. If you pass `NULL`, on return the display count contains the total number of displays specified in the mask.

`matchingDisplayCount`

A pointer to a display count variable you provide. On return, the display count contains the actual number of displays the function added to the `displays` array. This value is at most `maxDisplays`.

## Return Value

A result code. To interpret the result code, see [`CGError`](/documentation/CoreGraphics/CGError).

## Discussion

---

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)