---
title: "copyRenderedTexture(forCGLContext:pixelFormat:bounds:isFlipped:)"
framework: quartz
role: symbol
role_heading: Instance Method
path: "quartz/qcpluginoutputimageprovider/copyrenderedtexture(forcglcontext:pixelformat:bounds:isflipped:)"
---

# copyRenderedTexture(forCGLContext:pixelFormat:bounds:isFlipped:)

Returns the name of an OpenGL texture of type GL_TEXTURE_RECTANGLE_EXT that contains a subregion of the image in a given pixel format.

## Declaration

```swift
optional func copyRenderedTexture(forCGLContext cgl_ctx: CGLContextObj!, pixelFormat format: String!, bounds: NSRect, isFlipped flipped: UnsafeMutablePointer<ObjCBool>!) -> GLuint
```

## Parameters

- `cgl_ctx`: The CGL context to render to.
- `format`: A string that represents the pixel format of the texture.
- `bounds`: The bounds of the subregion of the image.
- `flipped`: Set to doc://com.apple.documentation/documentation/Swift/true on output if the contents of the returned texture are vertically flipped.

## Return Value

Return Value The name of an OpenGL texture of type GL_TEXTURE_RECTANGLE_EXT that contains a subregion of the image in a given pixel format or 0 if the texture can’t be provided.

## Discussion

Discussion Implement this method if you want to create the texture yourself or use framebuffer objects (FBO). Use <OpenGL/CGLMacro.h> to send commands to the OpenGL context. Make sure to preserve all the OpenGL states except the ones defined by GL_CURRENT_BIT.

## See Also

### Rendering an Image to a Destination

- [render(toBuffer:withBytesPerRow:pixelFormat:forBounds:)](quartz/qcpluginoutputimageprovider/render(tobuffer:withbytesperrow:pixelformat:forbounds:).md)
- [render(withCGLContext:forBounds:)](quartz/qcpluginoutputimageprovider/render(withcglcontext:forbounds:).md)
- [releaseRenderedTexture(_:forCGLContext:)](quartz/qcpluginoutputimageprovider/releaserenderedtexture(_:forcglcontext:).md)
