- if (display == EGL_NO_DISPLAY)
- exitEglError("Failed to get EGL display");
- if (eglInitialize(display, &eglMajor, &eglMinor) == EGL_FALSE)
- exitEglError("Failed to initialize EGL");
- printf("Using EGL version %d.%d\n", eglMajor, eglMinor);
- eglBindAPI(EGL_OPENGL_API);
+ if (display == EGL_NO_DISPLAY)
+ dieEgl("Failed to get EGL display");
+ if (eglInitialize(display, &eglMajor, &eglMinor) == EGL_FALSE)
+ dieEgl("Failed to initialize EGL");
+ printf("Using EGL version: %d.%d\n", eglMajor, eglMinor);
+ if (eglMajor == 1 && eglMinor < 4) {
+ // Choosing the GL context version requires EGL 1.3, creating an OpenGL 3 context requires EGL 1.4
+ die("Need at least EGL 1.4 to function properly\n");
+ }
+#ifdef CON_GLES2
+ if (eglBindAPI(EGL_OPENGL_ES_API) == EGL_FALSE)
+#else
+ if (eglBindAPI(EGL_OPENGL_API) == EGL_FALSE)
+#endif
+ dieEgl("Failed to bind API");
+ // check for the extension we need
+#ifdef CON_GL3
+ if (!haveEGLExtension("EGL_KHR_create_context")) {
+ die("Required EGL extension EGL_KHR_create_context is not supported\n");
+ }
+#endif