Graphics Reference
In-Depth Information
Table 3-3
Possible Errors When eglCreateWindowSurface Fails
Error Code
Description
EGL_BAD_MATCH This situation occurs when:
• The attributes of the native window do not match
those of the provided EGLConfig .
• The provided EGLConfig does not support rendering
into a window (i.e., the EGL_SURFACE_TYPE attribute
does not have the EGL_WINDOW_BIT set).
EGL_BAD_CONFIG This error is flagged if the provided EGLConfig is not
supported by the system.
EGL_BAD_
NATIVE_WINDOW
This error is specified if the provided native window
handle is not valid.
EGL_BAD_ALLOC
This error occurs if eglCreateWindowSurface is
unable to allocate the resources for the new EGL window,
or if there is already an EGLConfig associated with the
provided native window.
Putting this all together, our code for creating a window is shown in
Example 3-4.
Example 3-4
Creating an EGL Window Surface
EGLint attribList[] =
{
EGL_RENDER_BUFFER, EGL_BACK_BUFFER,
EGL_NONE
);
EGLSurface window = eglCreateWindowSurface ( display, config,
nativeWindow,
attribList );
if ( window == EGL_NO_SURFACE )
{
switch ( eglGetError ( ) )
{
case EGL_BAD_MATCH:
// Check window and EGLConfig attributes to determine
// compatibility, or verify that the EGLConfig
// supports rendering to a window
break;
case EGL_BAD_CONFIG:
// Verify that provided EGLConfig is valid
break;
(continues)
 
 
Search WWH ::




Custom Search