Graphics Reference
In-Depth Information
To have EGL make the choice of matching
EGLConfigs
, use this function:
EGLBoolean
eglChooseConfig
(EGLDisplay
display
,
const EGLint *
attribList
,
EGLConfig *
configs
,
EGLint
maxReturnConfigs
,
EGLint *
numConfigs
)
display
specifies the EGL display connection
attribList
specifies the list of attributes to match by
configs
configs
specifies the list of configurations
maxReturnConfigs
specifies the size of configurations
numConfigs
specifies the size of configurations returned
This function returns
EGL_TRUE
if the call succeeded. On failure,
EGL_FALSE
is returned, and an
EGL_BAD_ATTRIBUTE
error is posted if
attribList
contains an undefined EGL attribute or an attribute value
that is unrecognized or out of range.
You need to provide a list of the attributes, with associated preferred
values for all the attributes that are important for the correct operation of
your application. For example, if you need an
EGLConfig
that supports
a rendering surface having five bits red and blue, and six bits green (the
commonly used “RGB 565” format); a depth buffer; and OpenGL ES 3.0,
you might declare the array shown in Example 3-2.
For values that are not explicitly specified in the attribute list, EGL will use the
default values shown in Table 3-1. Additionally, when specifying a numeric
value for an attribute, EGL will guarantee the returned configuration has at
least that value at a minimum if there is a matching
EGLConfig
available.
Example 3-2
Specifying EGL Attributes
EGLint attribList[] =
{
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT_KHR,
EGL_RED_SIZE, 5,
EGL_GREEN_SIZE, 6,
EGL_BLUE_SIZE, 5,
EGL_DEPTH_SIZE, 1,
EGL_NONE
};