Initialising EGL Objects#
The following steps set up all of the EGL constructs required for this application and check if they have been initialised correctly. These constructs include a display, a configuration, a window surface, and a context.
They are primarily used to allow the application to display rendered images on screen as OpenGL ES has no way of doing this itself.
Initialise the EGL variables:
EGLConfig config = NULL;
EGLContext context = NULL;
_eglDisplay = NULL;
_eglSurface = NULL;
Create and initialise an EGLDisplay from the native display:
if (!createEGLDisplay())
{
return false;
}
Choose an EGLConfig for the application. This is used when setting up the rendering surface and EGLContext:
if (!chooseEGLConfig(config))
{
return false;
}
Create an EGLSurface for rendering from the native window:
if (!createEGLSurface(config))
{
return false;
}
Setup the EGL Context from the other EGL constructs created so far, so that the application is ready to submit OpenGL ES commands.
if (!setupEGLContext(config, context))
{
return false;
}
return true;