45 return "EGL is not or could not be initialized";
47 return "EGL cannot access a requested resource";
49 return "EGL failed to allocate resources for the requested operation";
51 return "An unrecognized attribute or attribute value was passed in the attribute list";
53 return "An EGLContext argument does not name a valid EGL rendering context";
55 return "An EGLConfig argument does not name a valid EGL frame buffer configuration";
57 return "The current surface of the calling thread is a window, pixel buffer or pixmap that is no longer valid";
59 return "An EGLDisplay argument does not name a valid EGL display connection";
61 return "An EGLSurface argument does not name a valid surface configured for GL rendering";
63 return "Arguments are inconsistent";
65 return "One or more argument values are invalid";
67 return "A NativePixmapType argument does not refer to a valid native pixmap";
69 return "A NativeWindowType argument does not refer to a valid native window";
71 return "The application must destroy all contexts and reinitialise";
73 return "ERROR: UNKNOWN EGL ERROR";
95 int i, nativeCount, usableCount;
104 nativeConfigs = calloc(nativeCount,
sizeof(
EGLConfig));
110 for (i = 0; i < nativeCount; i++)
123 #if defined(_GLFW_X11) 124 XVisualInfo vi = {0};
134 XVisualInfo* vis = XGetVisualInfo(
_glfw.x11.display,
147 if (ctxconfig->
major == 1)
186 return closest !=
NULL;
199 "EGL: Failed to make context current: %s",
212 "EGL: Failed to clear current context: %s",
226 "EGL: The context must be current on the calling thread when swapping buffers");
267 #if defined(_GLFW_X11) 280 if (window->
context.egl.surface)
286 if (window->
context.egl.handle)
303 const char* sonames[] =
305 #if defined(_GLFW_EGL_LIBRARY) 307 #elif defined(_GLFW_WIN32) 310 #elif defined(_GLFW_COCOA) 312 #elif defined(__CYGWIN__) 323 for (i = 0; sonames[
i]; i++)
336 _glfw.egl.prefix = (strncmp(sonames[i],
"lib", 3) == 0);
371 if (!
_glfw.egl.GetConfigAttrib ||
372 !
_glfw.egl.GetConfigs ||
373 !
_glfw.egl.GetDisplay ||
374 !
_glfw.egl.GetError ||
375 !
_glfw.egl.Initialize ||
376 !
_glfw.egl.Terminate ||
377 !
_glfw.egl.BindAPI ||
378 !
_glfw.egl.CreateContext ||
379 !
_glfw.egl.DestroySurface ||
380 !
_glfw.egl.DestroyContext ||
381 !
_glfw.egl.CreateWindowSurface ||
382 !
_glfw.egl.MakeCurrent ||
383 !
_glfw.egl.SwapBuffers ||
384 !
_glfw.egl.SwapInterval ||
385 !
_glfw.egl.QueryString ||
386 !
_glfw.egl.GetProcAddress)
389 "EGL: Failed to load required entry points");
399 "EGL: Failed to get EGL display: %s",
409 "EGL: Failed to initialize EGL: %s",
416 _glfw.egl.KHR_create_context =
418 _glfw.egl.KHR_create_context_no_error =
420 _glfw.egl.KHR_gl_colorspace =
422 _glfw.egl.KHR_get_all_proc_addresses =
424 _glfw.egl.KHR_context_flush_control =
434 if (
_glfw.egl.display)
447 #define setAttrib(a, v) \ 449 assert((size_t) (index + 1) < sizeof(attribs) / sizeof(attribs[0])); \ 450 attribs[index++] = a; \ 451 attribs[index++] = v; \ 465 if (!
_glfw.egl.display)
471 if (ctxconfig->
share)
477 "EGL: Failed to find a suitable EGLConfig");
486 "EGL: Failed to bind OpenGL ES: %s",
496 "EGL: Failed to bind OpenGL: %s",
502 if (
_glfw.egl.KHR_create_context)
517 if (ctxconfig->
debug)
538 if (
_glfw.egl.KHR_create_context_no_error)
542 if (ctxconfig->
major != 1 || ctxconfig->
minor != 0)
560 if (
_glfw.egl.KHR_context_flush_control)
577 config, share, attribs);
582 "EGL: Failed to create context: %s",
593 if (
_glfw.egl.KHR_gl_colorspace)
608 "EGL: Failed to create window surface: %s",
616 if (!
_glfw.egl.KHR_get_all_proc_addresses)
619 const char** sonames;
620 const char* es1sonames[] =
622 #if defined(_GLFW_GLESV1_LIBRARY) 623 _GLFW_GLESV1_LIBRARY,
624 #elif defined(_GLFW_WIN32) 627 #elif defined(_GLFW_COCOA) 628 "libGLESv1_CM.dylib",
635 const char* es2sonames[] =
637 #if defined(_GLFW_GLESV2_LIBRARY) 638 _GLFW_GLESV2_LIBRARY,
639 #elif defined(_GLFW_WIN32) 642 #elif defined(_GLFW_COCOA) 644 #elif defined(__CYGWIN__) 651 const char* glsonames[] =
653 #if defined(_GLFW_OPENGL_LIBRARY) 654 _GLFW_OPENGL_LIBRARY,
655 #elif defined(_GLFW_WIN32) 656 #elif defined(_GLFW_COCOA) 665 if (ctxconfig->
major == 1)
666 sonames = es1sonames;
668 sonames = es2sonames;
673 for (i = 0; sonames[
i]; i++)
677 if (
_glfw.egl.prefix != (strncmp(sonames[i],
"lib", 3) == 0))
688 "EGL: Failed to load client library");
707 #if defined(_GLFW_X11) 711 Visual** visual,
int*
depth)
717 const long vimask = VisualScreenMask | VisualIDMask;
722 "EGL: Failed to find a suitable EGLConfig");
729 desired.screen =
_glfw.x11.screen;
730 desired.visualid = visualID;
732 result = XGetVisualInfo(
_glfw.x11.display, vimask, &desired, &
count);
736 "EGL: Failed to retrieve Visual for EGLConfig");
740 *visual = result->visual;
741 *depth = result->depth;
756 return _glfw.egl.display;
770 return window->
context.egl.handle;
784 return window->
context.egl.surface;
#define EGL_OPENGL_ES_BIT
EGLBoolean(EGLAPIENTRY * PFN_eglDestroySurface)(EGLDisplay, EGLSurface)
_GLFWswapbuffersfun swapBuffers
#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR
#define GLFW_OPENGL_ES_API
EGLBoolean(EGLAPIENTRY * PFN_eglBindAPI)(EGLenum)
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR
static void makeContextCurrentEGL(_GLFWwindow *window)
EGLBoolean(EGLAPIENTRY * PFN_eglMakeCurrent)(EGLDisplay, EGLSurface, EGLSurface, EGLContext)
_GLFWgetprocaddressfun getProcAddress
EGLDisplay(EGLAPIENTRY * PFN_eglGetDisplay)(EGLNativeDisplayType)
static const char * getEGLErrorString(EGLint error)
#define GLFW_OPENGL_COMPAT_PROFILE
#define EGL_CONTEXT_CLIENT_VERSION
#define EGL_CONTEXT_MAJOR_VERSION_KHR
#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR
static int extensionSupportedEGL(const char *extension)
GLuint64 GLenum void * handle
#define EGL_NOT_INITIALIZED
const char *(EGLAPIENTRY * PFN_eglQueryString)(EGLDisplay, EGLint)
_GLFWdestroycontextfun destroy
#define EGL_LOSE_CONTEXT_ON_RESET_KHR
#define EGL_OPENGL_ES2_BIT
GLint GLint GLsizei GLsizei GLsizei depth
#define GLFW_NO_WINDOW_CONTEXT
The specified window does not have an OpenGL or OpenGL ES context.
EGLBoolean(EGLAPIENTRY * PFN_eglGetConfigs)(EGLDisplay, EGLConfig *, EGLint, EGLint *)
#define GLFW_LOSE_CONTEXT_ON_RESET
#define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR
#define EGL_NATIVE_VISUAL_ID
#define GLFW_API_UNAVAILABLE
GLFW could not find support for the requested API on the system.
#define EGL_CONTEXT_MINOR_VERSION_KHR
#define GLFW_FORMAT_UNAVAILABLE
The requested format is not supported or available.
EGLint(EGLAPIENTRY * PFN_eglGetError)(void)
#define GLFW_RELEASE_BEHAVIOR_NONE
#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR
#define EGL_RENDERABLE_TYPE
static void swapBuffersEGL(_GLFWwindow *window)
EGLBoolean(EGLAPIENTRY * PFN_eglTerminate)(EGLDisplay)
EGLBoolean(EGLAPIENTRY * PFN_eglDestroyContext)(EGLDisplay, EGLContext)
GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow *handle)
#define EGL_BAD_CURRENT_SURFACE
#define EGL_BAD_NATIVE_PIXMAP
#define _GLFW_REQUIRE_INIT_OR_RETURN(x)
static GLFWbool chooseEGLConfig(const _GLFWctxconfig *ctxconfig, const _GLFWfbconfig *desired, EGLConfig *result)
const _GLFWfbconfig * _glfwChooseFBConfig(const _GLFWfbconfig *desired, const _GLFWfbconfig *alternatives, unsigned int count)
#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR
#define EGL_BAD_ATTRIBUTE
GLFWbool _glfwCreateContextEGL(_GLFWwindow *window, const _GLFWctxconfig *ctxconfig, const _GLFWfbconfig *fbconfig)
static void swapIntervalEGL(int interval)
GLFWAPI EGLDisplay glfwGetEGLDisplay(void)
#define GLFW_PLATFORM_ERROR
A platform-specific error occurred that does not match any of the more specific categories.
#define EGL_GL_COLORSPACE_KHR
GLFWbool _glfwStringInExtensionString(const char *string, const char *extensions)
_W64 unsigned int uintptr_t
EGLBoolean(EGLAPIENTRY * PFN_eglSwapBuffers)(EGLDisplay, EGLSurface)
static void destroyContextEGL(_GLFWwindow *window)
#define EGL_NO_RESET_NOTIFICATION_KHR
void _glfwTerminateEGL(void)
#define EGL_CONTEXT_FLAGS_KHR
#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR
#define EGL_COLOR_BUFFER_TYPE
_GLFWmakecontextcurrentfun makeCurrent
GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow *handle)
void _glfwInputError(int code, const char *format,...)
#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR
_GLFWextensionsupportedfun extensionSupported
#define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR
#define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR
#define GLFW_RELEASE_BEHAVIOR_FLUSH
#define eglGetProcAddress
#define GLFW_VERSION_UNAVAILABLE
The requested OpenGL or OpenGL ES version is not available.
_GLFWswapintervalfun swapInterval
#define eglGetConfigAttrib
GLFWglproc(EGLAPIENTRY * PFN_eglGetProcAddress)(const char *)
void _glfwPlatformSetTls(_GLFWtls *tls, void *value)
#define eglDestroyContext
EGLBoolean(EGLAPIENTRY * PFN_eglSwapInterval)(EGLDisplay, EGLint)
EGLSurface(EGLAPIENTRY * PFN_eglCreateWindowSurface)(EGLDisplay, EGLConfig, EGLNativeWindowType, const EGLint *)
#define eglCreateWindowSurface
#define GLFW_OPENGL_CORE_PROFILE
#define EGL_BAD_PARAMETER
EGLBoolean(EGLAPIENTRY * PFN_eglInitialize)(EGLDisplay, EGLint *, EGLint *)
void * _glfwPlatformGetTls(_GLFWtls *tls)
EGLBoolean(EGLAPIENTRY * PFN_eglGetConfigAttrib)(EGLDisplay, EGLConfig, EGLint, EGLint *)
#define EGL_GL_COLORSPACE_SRGB_KHR
GLFWbool _glfwInitEGL(void)
#define EGL_OPENGL_ES_API
static GLFWglproc getProcAddressEGL(const char *procname)
static int getEGLConfigAttrib(EGLConfig config, int attrib)
#define EGL_BAD_NATIVE_WINDOW
#define GLFW_NO_RESET_NOTIFICATION
struct GLFWwindow GLFWwindow
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR
EGLContext(EGLAPIENTRY * PFN_eglCreateContext)(EGLDisplay, EGLConfig, EGLContext, const EGLint *)
#define eglDestroySurface