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

# canDraw(in:pixelFormat:forLayerTime:displayTime:)

Invoked to ask the layer whether it can (or should) draw.

```
func canDraw(in context: NSOpenGLContext, pixelFormat: NSOpenGLPixelFormat, forLayerTime t: CFTimeInterval, displayTime ts: UnsafePointer<CVTimeStamp>) -> Bool
```

## Parameters

`context`

The NSOpenGLContext in to which the OpenGL content would be drawn.

`pixelFormat`

The pixel format used when the context was created.

`t`

The current layer time.

`ts`

The display timestamp associated with timeInterval. Can be `null`.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the receiver should render OpenGL content, <doc://com.apple.documentation/documentation/Swift/false> otherwise.

## Discussion

This method is called before attempting to render the frame for the layer time specified by `timeInterval`. If the method returns <doc://com.apple.documentation/documentation/Swift/false>, the frame is skipped. The default implementation always returns <doc://com.apple.documentation/documentation/Swift/true>.

## See Also

  [Core Animation Programming Guide](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CoreAnimation_guide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40004514)



---

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)