<!--
{
  "availability" : [
    "macCatalyst: -",
    "macOS: 10.2.0 - 10.7.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSOpenGLPixelBuffer",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSOpenGLPixelBuffer"
  },
  "title" : "NSOpenGLPixelBuffer"
}
-->

# NSOpenGLPixelBuffer

An object that provides access to accelerated offscreen rendering.

```
@interface NSOpenGLPixelBuffer : NSObject
```

## Overview> Deprecated: The OpenGL API is deprecated. Use <doc://com.apple.documentation/documentation/Metal> and <doc://com.apple.documentation/documentation/MetalKit> instead.

Using offscreen rendering you could, for example, draw into the pixel buffer, then use the contents as a texture map elsewhere. Typically you initialize an [`NSOpenGLPixelBuffer`](/documentation/AppKit/NSOpenGLPixelBuffer) object using the [`initWithTextureTarget:textureInternalFormat:textureMaxMipMapLevel:pixelsWide:pixelsHigh:`](/documentation/AppKit/NSOpenGLPixelBuffer/initWithTextureTarget:textureInternalFormat:textureMaxMipMapLevel:pixelsWide:pixelsHigh:) method and attach the resulting object to an OpenGL context with the [`setPixelBuffer:cubeMapFace:mipMapLevel:currentVirtualScreen:`](/documentation/AppKit/NSOpenGLContext/setPixelBuffer:cubeMapFace:mipMapLevel:currentVirtualScreen:) method of [`NSOpenGLContext`](/documentation/AppKit/NSOpenGLContext).

Every [`NSOpenGLPixelBuffer`](/documentation/AppKit/NSOpenGLPixelBuffer) object wraps a low-level, platform-specific Core OpenGL (CGL) pixel buffer object. Your application can retrieve the CGL pixel buffer by calling the [`CGLPBufferObj`](/documentation/AppKit/NSOpenGLPixelBuffer/CGLPBufferObj) method. For more information on the underling CGL pixel buffer, see `CGL`.

## Topics

### Initializing an OpenGL Pixel Buffer

[`initWithTextureTarget:textureInternalFormat:textureMaxMipMapLevel:pixelsWide:pixelsHigh:`](/documentation/AppKit/NSOpenGLPixelBuffer/initWithTextureTarget:textureInternalFormat:textureMaxMipMapLevel:pixelsWide:pixelsHigh:)

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

[`initWithCGLPBufferObj:`](/documentation/AppKit/NSOpenGLPixelBuffer/initWithCGLPBufferObj:)

Initializes and returns an OpenGL pixel buffer object that encapsulates an existing CGL pixel buffer object.

### Getting OpenGL Pixel Buffer Information

[`CGLPBufferObj`](/documentation/AppKit/NSOpenGLPixelBuffer/CGLPBufferObj)

The underlying CGL pixel buffer object associated with the OpenGL pixel buffer object.

[`pixelsHigh`](/documentation/AppKit/NSOpenGLPixelBuffer/pixelsHigh)

The height of the OpenGL pixel buffer’s texture (in pixels).

[`pixelsWide`](/documentation/AppKit/NSOpenGLPixelBuffer/pixelsWide)

The width of the OpenGL pixel buffer’s texture, in pixels.

[`textureInternalFormat`](/documentation/AppKit/NSOpenGLPixelBuffer/textureInternalFormat)

The internal format of the OpenGL pixel buffer’s texture.

[`textureMaxMipMapLevel`](/documentation/AppKit/NSOpenGLPixelBuffer/textureMaxMipMapLevel)

The maximum mipmap level of the OpenGL pixel buffer’s texture.

[`textureTarget`](/documentation/AppKit/NSOpenGLPixelBuffer/textureTarget)

The texture target of the OpenGL pixel buffer.



---

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)