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

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

Draws the OpenGL content for the specified time.

## Declaration

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

## 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.

## Discussion

Discussion This method is called when a new frame needs to be generated for the layer time specified by timeInterval.

## See Also

### Drawing the Content

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