---
title: "canDraw(in:pixelFormat:forLayerTime:displayTime:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsopengllayer/candraw(in:pixelformat:forlayertime:displaytime:)"
---

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

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

## Declaration

```swift
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

Return Value true if the receiver should render OpenGL content, false otherwise.

## Discussion

Discussion This method is called before attempting to render the frame for the layer time specified by timeInterval. If the method returns false, the frame is skipped. The default implementation always returns true.

## See Also

### Related Documentation

- [Core Animation Programming Guide](apple-archive/documentation/Cocoa/Conceptual/CoreAnimation_guide/Introduction.md)

### Drawing the Content

- [draw(in:pixelFormat:forLayerTime:displayTime:)](appkit/nsopengllayer/draw(in:pixelformat:forlayertime:displaytime:).md)
