<!--
{
  "availability" : [
    "macOS: 10.5.0 - 10.14.0"
  ],
  "documentType" : "symbol",
  "framework" : "Quartz",
  "identifier" : "/documentation/Quartz/QCPlugInOutputImageProvider/render(withCGLContext:forBounds:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Quartz"
    ],
    "preciseIdentifier" : "c:objc(pl)QCPlugInOutputImageProvider(im)renderWithCGLContext:forBounds:"
  },
  "title" : "render(withCGLContext:forBounds:)"
}
-->

# render(withCGLContext:forBounds:)

Renders a subregion of the image to the provided CGL context.

```
optional func render(withCGLContext cgl_ctx: CGLContextObj!, forBounds bounds: NSRect) -> Bool
```

## Parameters

`cgl_ctx`

The CGL context to render to.

`bounds`

The bounds of the subregion.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if successful; <doc://com.apple.documentation/documentation/Swift/false> on failure or if the image provider doesn’t support GPU rendering.

## Discussion

The view port is set for you. The model view and projection  matrixes are set to the identity.

Your OpenGL code should save and restore all states *except* for those that are part of `GL_CURRENT_BIT` (vertex position, color, texture, and so on). Also use CGL macros instead of changing the current context, by including this statement:

`#import <OpenGL/CGLMacro.h>`

For more details, see [Quartz Composer Custom Patch Programming Guide](https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/QuartzComposer_Patch_PlugIn_ProgGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40004787).

---

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)