Hello,
Please take a look to this code.

////////////////////////////////////////////////
EGLDisplay eglDisplay = 0;
EGLConfig eglConfig = 0;
EGLSurface eglSurface = 0;...