And a little question: The code has to be modified?
This is the code fragment where I create the EGL window:
static int init_egl( int w, int h, int bpp )
{
typedef NativeDisplayType EGLNativeDisplayType;
typedef NativeWindowType EGLNativeWindowType;
//EGLint disp_w, disp_h;
int maj, min;
EGLNativeDisplayType disp_type;
EGLNativeWindowType window;
EGLConfig cfgs[2];
EGLint n_cfgs;
EGLint egl_attr[] = {
EGL_BUFFER_SIZE, EGL_DONT_CARE,
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_DEPTH_SIZE, 8,
EGL_NONE };
struct {
EGLint render_buffer[2];
EGLint none;
} egl_surf_attr = {
/* double-buffering */
.render_buffer = { EGL_RENDER_BUFFER, EGL_BACK_BUFFER },
/* End of list */
.none = EGL_NONE
};
disp_type = (EGLNativeDisplayType)EGL_DEFAULT_DISPLAY;
dpy = eglGetDisplay(disp_type);
if (eglInitialize(dpy, &maj, &min) != EGL_TRUE) {
printf("eglInitialize\n");
return 0;
}
if (eglGetConfigs(dpy, cfgs, 2, &n_cfgs) != EGL_TRUE) {
printf("eglGetConfigs\n");
goto cleanup;
}
if (eglChooseConfig(dpy, egl_attr, cfgs, 2, &n_cfgs) != EGL_TRUE) {
printf("eglChooseConfig\n");
goto cleanup;
}
disp_type = fbGetDisplay(NULL);
window = fbCreateWindow(disp_type, 0, 1, w, h);
surface = eglCreateWindowSurface(dpy, cfgs[0], window, /*(EGLint*)&egl_surf_attr*/NULL);
if (surface == EGL_NO_SURFACE) {
printf("eglCreateWindowSurface\n");
goto cleanup;
}
context = eglCreateContext(dpy, cfgs[0], EGL_NO_CONTEXT, NULL);
if (context == EGL_NO_CONTEXT) {
printf("eglCreateContext\n");
goto cleanup;
}
if (eglMakeCurrent(dpy, surface, surface, context) != EGL_TRUE) {
printf("eglMakeCurrent\n");
goto cleanup;
}
return 1;
cleanup:
deinit_egl();
return 0;
}