<!--
{
  "availability" : [
    "macCatalyst: -",
    "macOS: 10.3.0 - 10.7.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSOpenGLContext/setPixelBuffer:cubeMapFace:mipMapLevel:currentVirtualScreen:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSOpenGLContext(im)setPixelBuffer:cubeMapFace:mipMapLevel:currentVirtualScreen:"
  },
  "title" : "setPixelBuffer:cubeMapFace:mipMapLevel:currentVirtualScreen:"
}
-->

# setPixelBuffer:cubeMapFace:mipMapLevel:currentVirtualScreen:

Attaches the specified pixel buffer to the OpenGL context.

```
- (void) setPixelBuffer:(NSOpenGLPixelBuffer *) pixelBuffer cubeMapFace:(GLenum) face mipMapLevel:(GLint) level currentVirtualScreen:(GLint) screen;
```

## Parameters

`pixelBuffer`

The pixel buffer to attach.

`face`

For pixel buffers with a texture target of `GL_CUBE_MAP`, this parameter should be zero or one of the following values:

- `GL_TEXTURE_CUBE_MAP_POSITIVE_X`
- `GL_TEXTURE_CUBE_MAP_POSITIVE_Y`
- `GL_TEXTURE_CUBE_MAP_POSITIVE_Z`
- `GL_TEXTURE_CUBE_MAP_NEGATIVE_X`
- `GL_TEXTURE_CUBE_MAP_NEGATIVE_Y`
- `GL_TEXTURE_CUBE_MAP_NEGATIVE_Z`

`level`

The desired mipmap level for rendering. This value must be less than or equal to the maximum texture mipmap level of `pixelBuffer` (accessible through an `NSOpenGLPixelBuffer` object’s [`textureMaxMipMapLevel`](/documentation/AppKit/NSOpenGLPixelBuffer/textureMaxMipMapLevel) method).

`screen`

The virtual screen of the receiver (if applicable) should be set to the same value as the current virtual screen you are using for rendering onscreen

## Discussion

The `NSOpenGLPixelBuffer` object gives the receiver access to accelerated offscreen rendering in the pixel buffer, which is primarily used for textures.

## See Also

[`- (instancetype) initWithTextureTarget:(GLenum) target textureInternalFormat:(GLenum) format textureMaxMipMapLevel:(GLint) maxLevel pixelsWide:(GLsizei) pixelsWide pixelsHigh:(GLsizei) pixelsHigh;`](/documentation/AppKit/NSOpenGLPixelBuffer/initWithTextureTarget:textureInternalFormat:textureMaxMipMapLevel:pixelsWide:pixelsHigh:)

Returns an `NSOpenGLPixelBuffer` object initialized with the specified parameters.

[`var currentVirtualScreen: GLint`](/documentation/AppKit/NSOpenGLContext/currentVirtualScreen)

Returns the current virtual screen for the OpenGL context.



---

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)