# FrameBufferRenderer.RenderCallback

Artifact: [androidx.graphics:graphics-core](https://developer.android.com/jetpack/androidx/releases/graphics) [View Source](https://cs.android.com/search?q=file:androidx/graphics/opengl/FrameBufferRenderer.kt+class:androidx.graphics.opengl.FrameBufferRenderer.RenderCallback) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

*** ** * ** ***


```
interface FrameBufferRenderer.RenderCallback
```

<br />

*** ** * ** ***

Callbacks invoked to render content leveraging a `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBufferRenderer`

## Summary

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBuffer` | `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBufferRenderer.RenderCallback#obtainFrameBuffer(androidx.graphics.opengl.egl.EGLSpec)(egl: https://developer.android.com/reference/kotlin/androidx/graphics/opengl/egl/EGLSpec)` Obtain a `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBuffer` to render content into. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBufferRenderer.RenderCallback#onDraw(androidx.graphics.opengl.egl.EGLManager)(eglManager: https://developer.android.com/reference/kotlin/androidx/graphics/opengl/egl/EGLManager)` Draw contents into the `https://developer.android.com/reference/android/hardware/HardwareBuffer.html`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBufferRenderer.RenderCallback#onDrawComplete(androidx.graphics.opengl.FrameBuffer,androidx.hardware.SyncFenceCompat)( frameBuffer: https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBuffer, syncFenceCompat: https://developer.android.com/reference/kotlin/androidx/hardware/SyncFenceCompat? )` Callback when `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBufferRenderer.RenderCallback#onDraw(androidx.graphics.opengl.egl.EGLManager)` is complete and the contents of the draw are reflected in the corresponding `https://developer.android.com/reference/android/hardware/HardwareBuffer.html`. |

## Public functions

### obtainFrameBuffer

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

```
fun obtainFrameBuffer(egl: EGLSpec): FrameBuffer
```

Obtain a `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBuffer` to render content into. The `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBuffer` obtained here is expected to be managed by the consumer of `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBufferRenderer`. That is implementations of this API are expected to be maintaining a reference to the returned `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBuffer` here and calling `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBuffer#close()` where appropriate as the instance will not be released by `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBufferRenderer`.

| Parameters |
|---|---|
| `egl: https://developer.android.com/reference/kotlin/androidx/graphics/opengl/egl/EGLSpec` | EGLSpec that is utilized within creation of the `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBuffer` object |

### onDraw

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

```
fun onDraw(eglManager: EGLManager): Unit
```

Draw contents into the `https://developer.android.com/reference/android/hardware/HardwareBuffer.html`. Before this method is invoked the `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBuffer` instance returned in `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBufferRenderer.RenderCallback#obtainFrameBuffer(androidx.graphics.opengl.egl.EGLSpec)` is made current

### onDrawComplete

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

```
fun onDrawComplete(
    frameBuffer: FrameBuffer,
    syncFenceCompat: SyncFenceCompat?
): Unit
```

Callback when `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBufferRenderer.RenderCallback#onDraw(androidx.graphics.opengl.egl.EGLManager)` is complete and the contents of the draw are reflected in the corresponding `https://developer.android.com/reference/android/hardware/HardwareBuffer.html`.

| Parameters |
|---|---|
| `frameBuffer: https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBuffer` | `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBuffer` that content is rendered into. The frameBuffer should not be consumed unless the syncFenceCompat is signalled or the fence is null. This is the same `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBuffer` instance returned in `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBufferRenderer.RenderCallback#obtainFrameBuffer(androidx.graphics.opengl.egl.EGLSpec)` |
| `syncFenceCompat: https://developer.android.com/reference/kotlin/androidx/hardware/SyncFenceCompat?` | `https://developer.android.com/reference/kotlin/androidx/hardware/SyncFenceCompat` is used to determine when rendering is done in `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBufferRenderer.RenderCallback#onDraw(androidx.graphics.opengl.egl.EGLManager)` and reflected within the given frameBuffer. |