EGLConfigAttributes


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

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

const Int

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

const Int

EGL configuration attribute value that represents fixed point RGBA components

const Int

EGL configuration attribute value that represents floating point RGBA components

Public companion properties

EGLConfigAttributes

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

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

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 functions

IntArray

Return a copy of the created integer array used for EGL methods.

Constants

EGL_COLOR_COMPONENT_TYPE_EXT

const val EGL_COLOR_COMPONENT_TYPE_EXT = 13113: Int

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

const val EGL_COLOR_COMPONENT_TYPE_FIXED_EXT = 13114: Int

EGL configuration attribute value that represents fixed point RGBA components

EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT

const val EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT = 13115: Int

EGL configuration attribute value that represents floating point RGBA components

Public companion properties

RGBA_1010102

val RGBA_1010102EGLConfigAttributes

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

val RGBA_8888EGLConfigAttributes

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

val RGBA_F16EGLConfigAttributes

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 functions

toArray

Added in 1.0.0
fun toArray(): IntArray

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.