---
title: "bindTextureRepresentation(toCGLContext:textureUnit:normalizeCoordinates:)"
framework: quartz
role: symbol
role_heading: Instance Method
path: "quartz/qcplugininputimagesource/bindtexturerepresentation(tocglcontext:textureunit:normalizecoordinates:)"
---

# bindTextureRepresentation(toCGLContext:textureUnit:normalizeCoordinates:)

Binds the texture to a given texture unit and optionally scales or flips the texture.

## Declaration

```swift
func bindTextureRepresentation(toCGLContext cgl_ctx: CGLContextObj!, textureUnit unit: GLenum, normalizeCoordinates flag: Bool)
```

## Parameters

- `cgl_ctx`: The CGL context to render to.)
- `unit`: The texture unit to bind to (such as, GL_TEXTURE0)
- `flag`: To apply a texture matrix to scale coordinates (from [0, pixels] to [0,1]) and flip them vertically (if necessary), pass doc://com.apple.documentation/documentation/Swift/true.

## Discussion

Discussion When you no longer need the texture, call unbindTextureRepresentation(fromCGLContext:textureUnit:).

## See Also

### Converting an Image to a Representation

- [lockTextureRepresentation(with:forBounds:)](quartz/qcplugininputimagesource/locktexturerepresentation(with:forbounds:).md)
- [unlockTextureRepresentation()](quartz/qcplugininputimagesource/unlocktexturerepresentation().md)
- [lockBufferRepresentation(withPixelFormat:colorSpace:forBounds:)](quartz/qcplugininputimagesource/lockbufferrepresentation(withpixelformat:colorspace:forbounds:).md)
- [unbindTextureRepresentation(fromCGLContext:textureUnit:)](quartz/qcplugininputimagesource/unbindtexturerepresentation(fromcglcontext:textureunit:).md)
- [unlockBufferRepresentation()](quartz/qcplugininputimagesource/unlockbufferrepresentation().md)
