# 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)

*** ** * ** ***


```
public interface FrameBufferRenderer.RenderCallback
```

<br />

*** ** * ** ***

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

## Summary

| ### Public methods |
|---|---|
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/opengl/FrameBuffer` | `https://developer.android.com/reference/androidx/graphics/opengl/FrameBufferRenderer.RenderCallback#obtainFrameBuffer(androidx.graphics.opengl.egl.EGLSpec)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLSpec egl)` Obtain a `https://developer.android.com/reference/androidx/graphics/opengl/FrameBuffer` to render content into. |
| `abstract void` | `https://developer.android.com/reference/androidx/graphics/opengl/FrameBufferRenderer.RenderCallback#onDraw(androidx.graphics.opengl.egl.EGLManager)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLManager eglManager)` Draw contents into the `https://developer.android.com/reference/android/hardware/HardwareBuffer.html`. |
| `abstract void` | `https://developer.android.com/reference/androidx/graphics/opengl/FrameBufferRenderer.RenderCallback#onDrawComplete(androidx.graphics.opengl.FrameBuffer,androidx.hardware.SyncFenceCompat)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/opengl/FrameBuffer frameBuffer, https://developer.android.com/reference/androidx/hardware/SyncFenceCompat syncFenceCompat )` Callback when `https://developer.android.com/reference/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 methods

### obtainFrameBuffer

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

```
abstract @NonNull FrameBuffer obtainFrameBuffer(@NonNull EGLSpec egl)
```

Obtain a `https://developer.android.com/reference/androidx/graphics/opengl/FrameBuffer` to render content into. The `https://developer.android.com/reference/androidx/graphics/opengl/FrameBuffer` obtained here is expected to be managed by the consumer of `https://developer.android.com/reference/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/androidx/graphics/opengl/FrameBuffer` here and calling `https://developer.android.com/reference/androidx/graphics/opengl/FrameBuffer#close()` where appropriate as the instance will not be released by `https://developer.android.com/reference/androidx/graphics/opengl/FrameBufferRenderer`.

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

### onDraw

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

```
abstract void onDraw(@NonNull EGLManager eglManager)
```

Draw contents into the `https://developer.android.com/reference/android/hardware/HardwareBuffer.html`. Before this method is invoked the `https://developer.android.com/reference/androidx/graphics/opengl/FrameBuffer` instance returned in `https://developer.android.com/reference/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)

```
abstract void onDrawComplete(
    @NonNull FrameBuffer frameBuffer,
    SyncFenceCompat syncFenceCompat
)
```

Callback when `https://developer.android.com/reference/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 |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/opengl/FrameBuffer frameBuffer` | `https://developer.android.com/reference/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/androidx/graphics/opengl/FrameBuffer` instance returned in `https://developer.android.com/reference/androidx/graphics/opengl/FrameBufferRenderer.RenderCallback#obtainFrameBuffer(androidx.graphics.opengl.egl.EGLSpec)` |
| `https://developer.android.com/reference/androidx/hardware/SyncFenceCompat syncFenceCompat` | `https://developer.android.com/reference/androidx/hardware/SyncFenceCompat` is used to determine when rendering is done in `https://developer.android.com/reference/androidx/graphics/opengl/FrameBufferRenderer.RenderCallback#onDraw(androidx.graphics.opengl.egl.EGLManager)` and reflected within the given frameBuffer. |