Instance Property

wantsBestResolutionOpenGLSurface

A Boolean value indicating whether the view wants an OpenGL backing surface with a resolution greater than 1 pixel per point.

Declaration

var wantsBestResolutionOpenGLSurface: Bool { get set }

Return Value

true if the view wants a high resolution backing surface or false if it does not.

Discussion

This property is relevant only for views to which an NSOpenGLContext object is bound (including, but not limited to, NSOpenGLView objects). Layer-backed views ignore the value in this property and configure their own backing surface at an appropriate resolution.

For compatibility, the default value of this property is false, which results in a 1 pixel per point framebuffer regardless of the backing scale factor for the display the view occupies. (When the backing scale factor is greater than 1.0 , the rendered surface contents are magnified to the appropriate user size.) Changing the value to true tells AppKit that it has permission to allocate a higher resolution frame buffer for the view. AppKit uses the backing scale factor and the targeted display to determine whether a higher resolution buffer is appropriate, and it may change the surface resolution when the display mode changes or the view moves to a different display.

When you set this property to true, the view must be able to convert between view units and pixel units when needed. For example, passing the view’s bounds unmodified to the glViewport function yields incorrect results at backing scale factors other than 1.0. You can use the convertToBacking(_:), convertToBacking(_:), and convertToBacking(_:) methods to convert coordinate values to the resolution of the backing store.

To learn more about using OpenGL in your Mac app, see OpenGL Programming Guide for Mac.