---
title: "init(frame:pixelFormat:)"
framework: appkit
role: symbol
role_heading: Initializer
path: "appkit/nsopenglview/init(frame:pixelformat:)"
---

# init(frame:pixelFormat:)

Returns an NSOpenGLView object initialized with the specified frame rectangle and pixel format.

## Declaration

```swift
init?(frame frameRect: NSRect, pixelFormat format: NSOpenGLPixelFormat?)
```

## Parameters

- `frameRect`: The frame rectangle for the view, specified in the coordinate system of its parent view.
- `format`: The pixel format to use when creating the view’s NSOpenGLContext object.

## Return Value

Return Value An initialized NSOpenGLView object, or nil if the object could not be initialized.

## See Also

### Related Documentation

- [defaultPixelFormat()](appkit/nsopenglview/defaultpixelformat().md)
