# EGLConfigAttributes

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

*** ** * ** ***


```
public final class EGLConfigAttributes
```

<br />

*** ** * ** ***

Class responsible for containing configuration parameters to be consumed by `https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLSpec#loadConfig(androidx.graphics.opengl.egl.EGLConfigAttributes)` This contains a mapping of key value pairs for attribute names to values. This handles flattening the pairs into a single integer based array when passed to corresponding EGL based APIs with alternating key/value pairs and ends with `https://developer.android.com/reference/android/opengl/EGL14.html#EGL_NONE`. Consumers can create an instance by using `https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLConfigAttributes.Builder` or using the DSL based Kotlin API `https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLConfigAttributes` factory method. `https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLConfigAttributes` also provides a few constants for commonly used configurations such as `https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLConfigAttributes#RGBA_8888()`, `https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLConfigAttributes#RGBA_1010102()`, or `https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLConfigAttributes#RGBA_F16()`

For example from Java:

```
EGLConfigAttributes config = new EGLConfigAttributes.Builder()
  .setAttribute(EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT)
  .setAttribute(EGL14.EGL_RED_SIZE, 8)
  .setAttribute(EGL14.EGL_GREEN_SIZE, 8)
  .setAttribute(EGL14.EGL_BLUE_SIZE, 8)
  .setAttribute(EGL14.EGL_ALPHA_SIZE, 8)
  .setAttribute(EGL14.EGL_DEPTH_SIZE, 0)
  .setAttribute(EGL14.EGL_CONFIG_CAVEAT, EGL14.EGL_NONE)
  .setAttribute(EGL14.STENCIL_SIZE, 8)
  .setAttribute(EGL14.EGL_SURFACE_TYPE, EGL14.EGL_WINDOW_BIT)
  .build();
```

Or from the Kotlin factory method:

```
val config = EGLConfigAttributes {
     EGL14.EGL_RENDERABLE_TYPE to EGL14.EGL_OPENGL_ES2_BIT
     EGL14.EGL_RED_SIZE to 8
     EGL14.EGL_GREEN_SIZE to 8
     EGL14.EGL_BLUE_SIZE to 8
     EGL14.EGL_ALPHA_SIZE to 8
     EGL14.EGL_DEPTH_SIZE to 0
     EGL14.EGL_CONFIG_CAVEAT to EGL14.EGL_NONE
     EGL14.EGL_STENCIL_SIZE to 8
     EGL14.EGL_SURFACE_TYPE to EGL14.EGL_WINDOW_BIT
}
```

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLConfigAttributes.Builder` Builder used to create an instance of `https://developer.android.com/reference/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/androidx/graphics/opengl/egl/EGLConfigAttributes` instance to be used as a template and conditionally update individual mapped values |

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLConfigAttributes#EGL_COLOR_COMPONENT_TYPE_EXT() = 13113` EGL configuration attribute used to expose EGLConfigs that support formats with floating point RGBA components. |
| `static final int` | `https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLConfigAttributes#EGL_COLOR_COMPONENT_TYPE_FIXED_EXT() = 13114` EGL configuration attribute value that represents fixed point RGBA components |
| `static final int` | `https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLConfigAttributes#EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT() = 13115` EGL configuration attribute value that represents floating point RGBA components |

| ### Public fields |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLConfigAttributes` | `https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLConfigAttributes#RGBA_1010102()` EGL Attributes to create a 10 bit EGL config for red, green, blue, channels and a 2 bit alpha channels. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLConfigAttributes` | `https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLConfigAttributes#RGBA_8888()` EGL Attributes to create an 8 bit EGL config for red, green, blue, and alpha channels as well as an 8 bit stencil size |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLConfigAttributes` | `https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLConfigAttributes#RGBA_F16()` EGL Attributes to create a 16 bit floating point EGL config for red, green, blue and alpha channels without a depth or stencil channel. |

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull int[]` | `https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLConfigAttributes#toArray()()` Return a copy of the created integer array used for EGL methods. |

## Constants

### EGL_COLOR_COMPONENT_TYPE_EXT

```
public static final int EGL_COLOR_COMPONENT_TYPE_EXT = 13113
```

EGL configuration attribute used to expose EGLConfigs that support formats with floating point RGBA components. This attribute is exposed through the EGL_EXT_pixel_format_float EGL extension

See: https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_pixel_format_float.txt

### EGL_COLOR_COMPONENT_TYPE_FIXED_EXT

```
public static final int EGL_COLOR_COMPONENT_TYPE_FIXED_EXT = 13114
```

EGL configuration attribute value that represents fixed point RGBA components

### EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT

```
public static final int EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT = 13115
```

EGL configuration attribute value that represents floating point RGBA components

## Public fields

### RGBA_1010102

```
public static final @NonNull EGLConfigAttributes RGBA_1010102
```

EGL Attributes to create a 10 bit EGL config for red, green, blue, channels and a 2 bit alpha channels. This does not include any bits for depth and stencil buffers.

### RGBA_8888

```
public static final @NonNull EGLConfigAttributes RGBA_8888
```

EGL Attributes to create an 8 bit EGL config for red, green, blue, and alpha channels as well as an 8 bit stencil size

### RGBA_F16

```
public static final @NonNull EGLConfigAttributes RGBA_F16
```

EGL Attributes to create a 16 bit floating point EGL config for red, green, blue and alpha channels without a depth or stencil channel.

## Public methods

### toArray

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

```
public final @NonNull int[] toArray()
```

Return a copy of the created integer array used for EGL methods. Most consumers would pass the `https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLConfigAttributes` instance as a parameter instead, however, this method is provided as a convenience for debugging and testing purposes.