# FrameBuffer

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/FrameBuffer.kt+class:androidx.graphics.opengl.FrameBuffer) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

*** ** * ** ***


```
@RequiresApi(value = 26)
class FrameBuffer : AutoCloseable
```

<br />

*** ** * ** ***

Object that enables rendering into a `https://developer.android.com/reference/android/hardware/HardwareBuffer.html` by creating a frame buffer object from it by leveraging Android specific EGL extensions to create an `https://developer.android.com/reference/kotlin/androidx/opengl/EGLImageKHR` object that is loaded as a texture.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBuffer#FrameBuffer(androidx.graphics.opengl.egl.EGLSpec,android.hardware.HardwareBuffer)(egl: https://developer.android.com/reference/kotlin/androidx/graphics/opengl/egl/EGLSpec, hardwareBuffer: https://developer.android.com/reference/android/hardware/HardwareBuffer.html)` |

| ### Public functions |
|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBuffer#close()()` Closes out the frame buffer, freeing all resources within it. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBuffer#makeCurrent()()` Binds this frame buffer to the read and draw framebuffer targets if it's not closed. |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/android/hardware/HardwareBuffer.html` | `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBuffer#hardwareBuffer()` the `https://developer.android.com/reference/android/hardware/HardwareBuffer.html` that this class wraps and used to generate a `https://developer.android.com/reference/kotlin/androidx/opengl/EGLImageKHR` object |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/FrameBuffer#isClosed()` Boolean that tells if the frame buffer is currently closed |

## Public constructors

### FrameBuffer

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

```
FrameBuffer(egl: EGLSpec, hardwareBuffer: HardwareBuffer)
```

| Parameters |
|---|---|
| `egl: https://developer.android.com/reference/kotlin/androidx/graphics/opengl/egl/EGLSpec` | `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/egl/EGLSpec` used to specify EGL version and call various EGL methods |
| `hardwareBuffer: https://developer.android.com/reference/android/hardware/HardwareBuffer.html` | the `https://developer.android.com/reference/android/hardware/HardwareBuffer.html` that this class wraps and used to generate a `https://developer.android.com/reference/kotlin/androidx/opengl/EGLImageKHR` object |

## Public functions

### close

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

```
open fun close(): Unit
```

Closes out the frame buffer, freeing all resources within it. This should be done only when the frame buffer is no longer needed or being accessed.

### makeCurrent

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

```
fun makeCurrent(): Unit
```

Binds this frame buffer to the read and draw framebuffer targets if it's not closed. If the frame buffer is already closed this method will do nothing.

## Public properties

### hardwareBuffer

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

```
val hardwareBuffer: HardwareBuffer
```

the `https://developer.android.com/reference/android/hardware/HardwareBuffer.html` that this class wraps and used to generate a `https://developer.android.com/reference/kotlin/androidx/opengl/EGLImageKHR` object

### isClosed

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

```
val isClosed: Boolean
```

Boolean that tells if the frame buffer is currently closed