---
title: "CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext(_:_:_:)"
framework: corevideo
role: symbol
role_heading: Function
path: "corevideo/cvdisplaylinksetcurrentcgdisplayfromopenglcontext(_:_:_:)"
---

# CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext(_:_:_:)

Selects the display link most optimal for the current renderer of an OpenGL context.

## Declaration

```swift
func CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext(_ displayLink: CVDisplayLink, _ cglContext: CGLContextObj, _ cglPixelFormat: CGLPixelFormatObj) -> CVReturn
```

## Parameters

- `displayLink`: The display link whose current display is to be set.
- `cglContext`: The OpenGL context to retrieve the current renderer from.
- `cglPixelFormat`: The OpenGL pixel format used to create the passed-in OpenGL context.

## Return Value

Return Value A Core Video result code. See Core Video Constants for possible values.

## Discussion

Discussion This function chooses the display with the lowest refresh rate.

## See Also

### Configuring Display Links

- [CVDisplayLinkSetCurrentCGDisplay(_:_:)](corevideo/cvdisplaylinksetcurrentcgdisplay(_:_:).md)
- [CVDisplayLinkSetOutputCallback(_:_:_:)](corevideo/cvdisplaylinksetoutputcallback(_:_:_:).md)
- [CVDisplayLinkSetOutputHandler(_:_:)](corevideo/cvdisplaylinksetoutputhandler(_:_:).md)
- [CVDisplayLinkOutputHandler](corevideo/cvdisplaylinkoutputhandler.md)
