EGL的创建是这样的。
/**
* Creates an EGL rendering context and all associated elements
*/
void CreateEGL(EGLNativeWindowType window, EGLDisplay* outDisplay, EGLContext* outContext, EGLSurface* outSurface, EGLConfig* outConfig)
{
*outDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (*outDisplay == EGL_NO_DISPLAY)
{
ALog_A(0, "CreateEGL failed EGL unable to eglGetDisplay");
}
if (!eglInitialize(*outDisplay, NULL/*major*/, NULL/*minor*/))
{
ALog_A(0, "CreateEGL failed EGL unable to eglInitialize");
}
EGLint numConfigs;
// Here specify the attributes of the desired configuration.
// Below, we select an EGLConfig with at least 8 bits per color
// component compatible with on-screen windows
const EGLint configAttribs[] =
{
EGL_DEPTH_SIZE, 16,
EGL_RED_SIZE, 8, // 5,
EGL_GREEN_SIZE, 8, // 6,
EGL_BLUE_SIZE, 8, // 5,
EGL_ALPHA_SIZE,