# EGLConfigAttributes.Builder

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

*** ** * ** ***


```
class EGLConfigAttributes.Builder
```

<br />

*** ** * ** ***

Builder used to create an instance of `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/egl/EGLConfigAttributes` Allows for a mapping of EGL configuration attributes to their corresponding values as well as including a previously generated `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/egl/EGLConfigAttributes` instance to be used as a template and conditionally update individual mapped values

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/egl/EGLConfigAttributes.Builder#Builder()()` |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/egl/EGLConfigAttributes` | `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/egl/EGLConfigAttributes.Builder#build()()` Construct an instance of `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/egl/EGLConfigAttributes` with the mappings of integer keys to their respective values. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/egl/EGLConfigAttributes.Builder#include(androidx.graphics.opengl.egl.EGLConfigAttributes)(attributes: https://developer.android.com/reference/kotlin/androidx/graphics/opengl/egl/EGLConfigAttributes)` Include all the attributes of the given `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/egl/EGLConfigAttributes` instance. |
| `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/egl/EGLConfigAttributes.Builder` | `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/egl/EGLConfigAttributes.Builder#setAttribute(kotlin.Int,kotlin.Int)(attribute: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Map a given EGL configuration attribute key to the given EGL configuration value |
| `infix https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html.https://developer.android.com/reference/kotlin/androidx/graphics/opengl/egl/EGLConfigAttributes.Builder#(kotlin.Int).to(kotlin.Int)(that: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Map a given EGL configuration attribute key to the given EGL configuration value |

## Public constructors

### Builder

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

```
Builder()
```

## Public functions

### build

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

```
fun build(): EGLConfigAttributes
```

Construct an instance of `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/egl/EGLConfigAttributes` with the mappings of integer keys to their respective values. This creates a flat integer array with alternating values for the key value pairs and ends with EGL_NONE

### include

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

```
fun include(attributes: EGLConfigAttributes): Unit
```

Include all the attributes of the given `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/egl/EGLConfigAttributes` instance. This is useful for creating a new `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/egl/EGLConfigAttributes` instance with all the same attributes as another, allowing for modification of attributes after the fact. For example, the following code snippet can be used to create an `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/egl/EGLConfigAttributes` instance that has all the same configuration as `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/egl/EGLConfigAttributes#RGBA_8888()` but with a 16 bit stencil buffer size:

For example from Java:

new EglConfigAttributes.Builder() .include(EGLConfigAttributes.RGBA_8888) .setAttribute(EGL14.EGL_STENCIL_SIZE, 16) .build()

Or from the Kotlin factory method:

```kotlin
EGLConfigAttributes {
     include(EGLConfigAttributes.RGBA_8888)
     EGL14.EGL_STENCIL_SIZE to 16
}
```

That is all attributes configured after the include will overwrite the attributes configured previously.

### setAttribute

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

```
fun setAttribute(attribute: Int, value: Int): EGLConfigAttributes.Builder
```

Map a given EGL configuration attribute key to the given EGL configuration value

| Parameters |
|---|---|
| `attribute: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | EGL attribute name such as `https://developer.android.com/reference/android/opengl/EGL14.html#EGL_RED_SIZE` |
| `value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Corresponding value for the `https://developer.android.com/reference/kotlin/androidx/graphics/opengl/egl/EGLConfigAttributes.Builder#setAttribute(kotlin.Int,kotlin.Int)` |

### Int.to

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

```
infix fun Int.to(that: Int): Unit
```

Map a given EGL configuration attribute key to the given EGL configuration value