EGLConfigAttributes


public final class EGLConfigAttributes


Class responsible for containing configuration parameters to be consumed by EGLSpec.loadConfig 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 EGL14.EGL_NONE. Consumers can create an instance by using EGLConfigAttributes.Builder or using the DSL based Kotlin API EGLConfigAttributes factory method. EGLConfigAttributes also provides a few constants for commonly used configurations such as EGLConfigAttributes.RGBA_8888, EGLConfigAttributes.RGBA_1010102, or 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 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

Constants

static final int

EGL configuration attribute used to expose EGLConfigs that support formats with floating point RGBA components.

static final int

EGL configuration attribute value that represents fixed point RGBA components

static final int

EGL configuration attribute value that represents floating point RGBA components

Public fields

final @NonNull EGLConfigAttributes

EGL Attributes to create a 10 bit EGL config for red, green, blue, channels and a 2 bit alpha channels.

final @NonNull EGLConfigAttributes

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

final @NonNull EGLConfigAttributes

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 @NonNull int[]

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 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 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 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.2
public final @NonNull int[] toArray()

Return a copy of the created integer array used for EGL methods. Most consumers would pass the EGLConfigAttributes instance as a parameter instead, however, this method is provided as a convenience for debugging and testing purposes.