<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: 13.1.0 - 13.1.0",
    "macOS: 10.5.0 - 10.14.0"
  ],
  "documentType" : "symbol",
  "framework" : "QuartzCore",
  "identifier" : "/documentation/QuartzCore/CAOpenGLLayer/canDraw(inCGLContext:pixelFormat:forLayerTime:displayTime:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Animation"
    ],
    "preciseIdentifier" : "c:objc(cs)CAOpenGLLayer(im)canDrawInCGLContext:pixelFormat:forLayerTime:displayTime:"
  },
  "title" : "canDraw(inCGLContext:pixelFormat:forLayerTime:displayTime:)"
}
-->

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

Returns whether the receiver should draw OpenGL content for the specified time.

```
func canDraw(inCGLContext ctx: CGLContextObj, pixelFormat pf: CGLPixelFormatObj, forLayerTime t: CFTimeInterval, displayTime ts: UnsafePointer<CVTimeStamp>?) -> Bool
```

## Parameters

`ctx`

The `CGLContextObj` in to which the OpenGL content would be drawn.

`pf`

The pixel format used when the `glContext` 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>.

---

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)