<!--
{
  "availability" : [
    "macOS: 10.6.0 - 10.14.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSOpenGLLayer/openGLPixelFormat(forDisplayMask:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSOpenGLLayer(im)openGLPixelFormatForDisplayMask:"
  },
  "title" : "openGLPixelFormat(forDisplayMask:)"
}
-->

# openGLPixelFormat(forDisplayMask:)

Returns the OpenGL pixel format suitable for the specified displays.

```
func openGLPixelFormat(forDisplayMask mask: UInt32) -> NSOpenGLPixelFormat
```

## Parameters

`mask`

A mask specifying the displays the returned [`NSOpenGLPixelFormat`](/documentation/AppKit/NSOpenGLPixelFormat) must be suitable for.

## Return Value

An autoreleased [`NSOpenGLPixelFormat`](/documentation/AppKit/NSOpenGLPixelFormat) object suitable for the displays.

## Discussion

You must include an NSOpenGLPFAScreenMask specification in the pixel format attribute list that’s used to instantiate the NSOpenGLPixelFormat.

---

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)