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

# setTextureImageToPixelBuffer:colorBuffer:

Attaches the image data in the specified pixel buffer to the texture object currently bound by the OpenGL context.

```
- (void) setTextureImageToPixelBuffer:(NSOpenGLPixelBuffer *) pixelBuffer colorBuffer:(GLenum) source;
```

## Parameters

`pixelBuffer`

The pixel buffer to attach.

`source`

An OpenGL constant indicating which of the pixel buffer’s color buffers to use. Potential values for this parameter include `GL_FRONT`, `GL_BACK`, and `GL_AUX0`.

## Discussion

This method corresponds to the Core OpenGL method `CGLTexImagePBuffer`.

---

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)