EGLConfigAttributes.Builder


public final class EGLConfigAttributes.Builder


Builder used to create an instance of EGLConfigAttributes Allows for a mapping of EGL configuration attributes to their corresponding values as well as including a previously generated EGLConfigAttributes instance to be used as a template and conditionally update individual mapped values

Summary

Public constructors

Public methods

final @NonNull EGLConfigAttributes

Construct an instance of EGLConfigAttributes with the mappings of integer keys to their respective values.

final void

Include all the attributes of the given EGLConfigAttributes instance.

final @NonNull EGLConfigAttributes.Builder
setAttribute(int attribute, int value)

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

Public constructors

Builder

Added in 1.0.2
public Builder()

Public methods

build

Added in 1.0.2
public final @NonNull EGLConfigAttributes build()

Construct an instance of 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.2
public final void include(@NonNull EGLConfigAttributes attributes)

Include all the attributes of the given EGLConfigAttributes instance. This is useful for creating a new 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 EGLConfigAttributes instance that has all the same configuration as 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:

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.2
public final @NonNull EGLConfigAttributes.Builder setAttribute(int attribute, int value)

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

Parameters
int attribute

EGL attribute name such as EGL14.EGL_RED_SIZE

int value

Corresponding value for the attribute