Graphics Reference
In-Depth Information
Note:
Using the
EGL_OPENGL_ES3_BIT_KHR
attribute requires the
EGL_KHR_create_context
extension. This attribute is defined
in
eglext.h
(EGL v1.4). It is also worth noting that some
implementations will always promote OpenGL ES 2.0 contexts to
OpenGL ES 3.0 contexts, as OpenGL ES 3.0 is backward compatible
with OpenGL ES 2.0.
To use this set of attributes as a selection criteria, follow Example 3-3.
Example 3-3
Querying EGL Surface Configurations
const EGLint MaxConfigs = 10;
EGLConfig configs[MaxConfigs]; // We'll accept only 10 configs
EGLint numConfigs;
if ( !eglChooseConfig( display, attribList, configs, MaxConfigs,
&numConfigs ) )
{
// Something did not work ... handle error situation
}
else
{
// Everything is okay; continue to create a rendering surface
}
If
eglChooseConfig
returns successfully, a set of
EGLConfigs
matching
your criteria will be returned. If more than one
EGLConfig
matches
(with at most the maximum number of configurations you specify),
eglChooseConfig
will sort the configurations using the following ordering:
1.
By the value of
EGL_CONFIG_CAVEAT
. Precedence is given to
configurations where there are no configuration caveats (when the
value of
EGL_CONFIG_CAVEAT
is
EGL_NONE
), then slow rendering
configurations (
EGL_SLOW_CONFIG
), and finally nonconformant
configurations (
EGL_NON_CONFORMANT_CONFIG
).
2.
By the type of buffer as specified by
EGL_COLOR_BUFFER_TYPE
.
3.
By the number of bits in the color buffer in descending sizes. The
number of bits in a buffer depends on the
EGL_COLOR_BUFFER_TYPE
, and
will be at least the value specified for a particular color channel. When
the buffer type is
EGL_RGB_BUFFER
, the number of bits is computed
as the total of
EGL_RED_SIZE
,
EGL_GREEN_SIZE
, and
EGL_BLUE_SIZE
.
When the color buffer type is
EGL_LUMINANCE_BUFFER
, the number of
bits is the sum of
EGL_LUMINANCE_SIZE
and
EGL_ALPHA_SIZE
.
4.
By the value of
EGL_BUFFER_SIZE
in ascending order.