40static const char* getEGLErrorString(
EGLint error)
47 return "EGL is not or could not be initialized";
49 return "EGL cannot access a requested resource";
51 return "EGL failed to allocate resources for the requested operation";
53 return "An unrecognized attribute or attribute value was passed in the attribute list";
55 return "An EGLContext argument does not name a valid EGL rendering context";
57 return "An EGLConfig argument does not name a valid EGL frame buffer configuration";
59 return "The current surface of the calling thread is a window, pixel buffer or pixmap that is no longer valid";
61 return "An EGLDisplay argument does not name a valid EGL display connection";
63 return "An EGLSurface argument does not name a valid surface configured for GL rendering";
65 return "Arguments are inconsistent";
67 return "One or more argument values are invalid";
69 return "A NativePixmapType argument does not refer to a valid native pixmap";
71 return "A NativeWindowType argument does not refer to a valid native window";
73 return "The application must destroy all contexts and reinitialise";
75 return "ERROR: UNKNOWN EGL ERROR";
81static int getEGLConfigAttrib(
EGLConfig config,
int attrib)
97 int i, nativeCount, usableCount;
106 nativeConfigs = calloc(nativeCount,
sizeof(
EGLConfig));
112 for (i = 0; i < nativeCount; i++)
125#if defined(_GLFW_X11)
127 XVisualInfo vi = {0};
150 if (ctxconfig->
major == 1)
189 return closest !=
NULL;
192static void makeContextCurrentEGL(
_GLFWwindow* window)
202 "EGL: Failed to make context current: %s",
215 "EGL: Failed to clear current context: %s",
229 "EGL: The context must be current on the calling thread when swapping buffers");
236static void swapIntervalEGL(
int interval)
241static int extensionSupportedEGL(
const char* extension)
253static GLFWglproc getProcAddressEGL(
const char* procname)
270#if defined(_GLFW_X11)
307 const char* extensions;
308 const char* sonames[] =
310#if defined(_GLFW_EGL_LIBRARY)
312#elif defined(_GLFW_WIN32)
315#elif defined(_GLFW_COCOA)
317#elif defined(__CYGWIN__)
328 for (i = 0; sonames[i]; i++)
394 "EGL: Failed to load required entry points");
448 "EGL: Failed to get EGL display: %s",
458 "EGL: Failed to initialize EGL: %s",
466 extensionSupportedEGL(
"EGL_KHR_create_context");
468 extensionSupportedEGL(
"EGL_KHR_create_context_no_error");
470 extensionSupportedEGL(
"EGL_KHR_gl_colorspace");
472 extensionSupportedEGL(
"EGL_KHR_get_all_proc_addresses");
474 extensionSupportedEGL(
"EGL_KHR_context_flush_control");
496#define setAttrib(a, v) \
498 assert(((size_t) index + 1) < sizeof(attribs) / sizeof(attribs[0])); \
499 attribs[index++] = a; \
500 attribs[index++] = v; \
521 if (ctxconfig->
share)
524 if (!chooseEGLConfig(ctxconfig, fbconfig, &config))
527 "EGL: Failed to find a suitable EGLConfig");
536 "EGL: Failed to bind OpenGL ES: %s",
546 "EGL: Failed to bind OpenGL: %s",
554 int mask = 0, flags = 0;
567 if (ctxconfig->
debug)
592 if (ctxconfig->
major != 1 || ctxconfig->
minor != 0)
627 config, share, attribs);
632 "EGL: Failed to create context: %s",
668 "EGL: Failed to create window surface: %s",
679 const char** sonames;
680 const char* es1sonames[] =
682#if defined(_GLFW_GLESV1_LIBRARY)
683 _GLFW_GLESV1_LIBRARY,
684#elif defined(_GLFW_WIN32)
687#elif defined(_GLFW_COCOA)
688 "libGLESv1_CM.dylib",
695 const char* es2sonames[] =
697#if defined(_GLFW_GLESV2_LIBRARY)
698 _GLFW_GLESV2_LIBRARY,
699#elif defined(_GLFW_WIN32)
702#elif defined(_GLFW_COCOA)
704#elif defined(__CYGWIN__)
711 const char* glsonames[] =
713#if defined(_GLFW_OPENGL_LIBRARY)
714 _GLFW_OPENGL_LIBRARY,
715#elif defined(_GLFW_WIN32)
716#elif defined(_GLFW_COCOA)
725 if (ctxconfig->
major == 1)
726 sonames = es1sonames;
728 sonames = es2sonames;
733 for (i = 0; sonames[i]; i++)
748 "EGL: Failed to load client library");
767#if defined(_GLFW_X11)
771 Visual** visual,
int* depth)
776 EGLint visualID = 0, count = 0;
777 const long vimask = VisualScreenMask | VisualIDMask;
779 if (!chooseEGLConfig(ctxconfig, fbconfig, &native))
782 "EGL: Failed to find a suitable EGLConfig");
789 desired.screen =
_glfw.x11.screen;
790 desired.visualid = visualID;
796 "EGL: Failed to retrieve Visual for EGLConfig");
800 *visual = result->visual;
801 *depth = result->depth;
EGLenum _glfwPlatformGetEGLPlatform(EGLint **attribs)
EGLNativeWindowType _glfwPlatformGetEGLNativeWindow(_GLFWwindow *window)
EGLNativeDisplayType _glfwPlatformGetEGLNativeDisplay(void)
GLFWbool _glfwStringInExtensionString(const char *string, const char *extensions)
const _GLFWfbconfig * _glfwChooseFBConfig(const _GLFWfbconfig *desired, const _GLFWfbconfig *alternatives, unsigned int count)
void _glfwTerminateEGL(void)
GLFWAPI EGLDisplay glfwGetEGLDisplay(void)
GLFWbool _glfwInitEGL(void)
GLFWbool _glfwCreateContextEGL(_GLFWwindow *window, const _GLFWctxconfig *ctxconfig, const _GLFWfbconfig *fbconfig)
GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow *handle)
GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow *handle)
#define EGL_BAD_NATIVE_PIXMAP
#define EGL_OPENGL_ES_BIT
EGLBoolean(EGLAPIENTRY * PFN_eglSwapInterval)(EGLDisplay, EGLint)
EGLint(EGLAPIENTRY * PFN_eglGetError)(void)
#define EGL_NATIVE_VISUAL_ID
#define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR
#define eglCreatePlatformWindowSurfaceEXT
#define EGL_RENDERABLE_TYPE
#define EGL_GL_COLORSPACE_SRGB_KHR
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR
EGLSurface(EGLAPIENTRY * PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)(EGLDisplay, EGLConfig, void *, const EGLint *)
#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR
#define EGL_BAD_PARAMETER
#define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR
#define EGL_SINGLE_BUFFER
#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR
#define EGL_NOT_INITIALIZED
#define EGL_BAD_CURRENT_SURFACE
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR
#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR
EGLSurface(EGLAPIENTRY * PFN_eglCreateWindowSurface)(EGLDisplay, EGLConfig, EGLNativeWindowType, const EGLint *)
#define EGL_CONTEXT_MINOR_VERSION_KHR
#define EGL_OPENGL_ES2_BIT
EGLBoolean(EGLAPIENTRY * PFN_eglBindAPI)(EGLenum)
EGLBoolean(EGLAPIENTRY * PFN_eglDestroySurface)(EGLDisplay, EGLSurface)
#define EGL_CONTEXT_CLIENT_VERSION
EGLContext(EGLAPIENTRY * PFN_eglCreateContext)(EGLDisplay, EGLConfig, EGLContext, const EGLint *)
#define EGL_BAD_NATIVE_WINDOW
#define EGL_CONTEXT_MAJOR_VERSION_KHR
EGLBoolean(EGLAPIENTRY * PFN_eglGetConfigs)(EGLDisplay, EGLConfig *, EGLint, EGLint *)
#define EGL_NO_RESET_NOTIFICATION_KHR
void * EGLNativeWindowType
#define EGL_OPENGL_ES_API
#define eglGetPlatformDisplayEXT
#define eglGetProcAddress
EGLBoolean(EGLAPIENTRY * PFN_eglMakeCurrent)(EGLDisplay, EGLSurface, EGLSurface, EGLContext)
EGLBoolean(EGLAPIENTRY * PFN_eglInitialize)(EGLDisplay, EGLint *, EGLint *)
EGLBoolean(EGLAPIENTRY * PFN_eglGetConfigAttrib)(EGLDisplay, EGLConfig, EGLint, EGLint *)
EGLBoolean(EGLAPIENTRY * PFN_eglDestroyContext)(EGLDisplay, EGLContext)
EGLBoolean(EGLAPIENTRY * PFN_eglTerminate)(EGLDisplay)
#define EGL_COLOR_BUFFER_TYPE
#define eglDestroyContext
#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR
#define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR
#define EGL_RENDER_BUFFER
#define eglCreateWindowSurface
#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR
#define eglDestroySurface
#define EGL_CONTEXT_FLAGS_KHR
#define EGL_LOSE_CONTEXT_ON_RESET_KHR
EGLBoolean(EGLAPIENTRY * PFN_eglSwapBuffers)(EGLDisplay, EGLSurface)
#define EGL_PLATFORM_ANGLE_ANGLE
#define eglGetConfigAttrib
#define EGL_BAD_ATTRIBUTE
EGLDisplay(EGLAPIENTRY * PFN_eglGetDisplay)(EGLNativeDisplayType)
EGLDisplay(EGLAPIENTRY * PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum, void *, const EGLint *)
GLFWglproc(EGLAPIENTRY * PFN_eglGetProcAddress)(const char *)
const char *(EGLAPIENTRY * PFN_eglQueryString)(EGLDisplay, EGLint)
#define EGL_GL_COLORSPACE_KHR
#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR
#define GLFW_OPENGL_ES_API
#define GLFW_RELEASE_BEHAVIOR_FLUSH
#define GLFW_OPENGL_COMPAT_PROFILE
#define GLFW_LOSE_CONTEXT_ON_RESET
#define GLFW_NO_RESET_NOTIFICATION
#define GLFW_OPENGL_CORE_PROFILE
#define GLFW_RELEASE_BEHAVIOR_NONE
void(* GLFWglproc)(void)
GLFW API types.
#define GLFW_FORMAT_UNAVAILABLE
The requested format is not supported or available.
#define GLFW_API_UNAVAILABLE
GLFW could not find support for the requested API on the system.
#define GLFW_NO_WINDOW_CONTEXT
The specified window does not have an OpenGL or OpenGL ES context.
#define GLFW_VERSION_UNAVAILABLE
The requested OpenGL or OpenGL ES version is not available.
#define GLFW_PLATFORM_ERROR
A platform-specific error occurred that does not match any of the more specific categories.
struct GLFWwindow GLFWwindow
Opaque window object.
void _glfwInputError(int code, const char *format,...)
void _glfwPlatformSetTls(_GLFWtls *tls, void *value)
#define _GLFW_REQUIRE_INIT_OR_RETURN(x)
void * _glfwPlatformGetTls(_GLFWtls *tls)
_W64 unsigned int uintptr_t
_GLFWswapintervalfun swapInterval
_GLFWswapbuffersfun swapBuffers
_GLFWdestroycontextfun destroy
_GLFWmakecontextcurrentfun makeCurrent
_GLFWextensionsupportedfun extensionSupported
_GLFWgetprocaddressfun getProcAddress
PFN_eglGetProcAddress GetProcAddress
GLFWbool ANGLE_platform_angle_d3d
GLFWbool ANGLE_platform_angle_metal
PFN_eglMakeCurrent MakeCurrent
PFN_eglCreateWindowSurface CreateWindowSurface
PFN_eglQueryString QueryString
PFN_eglTerminate Terminate
GLFWbool EXT_platform_wayland
PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC CreatePlatformWindowSurfaceEXT
GLFWbool EXT_platform_base
PFN_eglInitialize Initialize
GLFWbool KHR_gl_colorspace
PFN_eglGetConfigs GetConfigs
GLFWbool KHR_create_context_no_error
GLFWbool ANGLE_platform_angle
GLFWbool ANGLE_platform_angle_vulkan
PFN_eglSwapBuffers SwapBuffers
PFNEGLGETPLATFORMDISPLAYEXTPROC GetPlatformDisplayEXT
PFN_eglSwapInterval SwapInterval
PFN_eglGetDisplay GetDisplay
GLFWbool KHR_context_flush_control
PFN_eglCreateContext CreateContext
GLFWbool EXT_platform_x11
GLFWbool KHR_create_context
PFN_eglDestroyContext DestroyContext
PFN_eglDestroySurface DestroySurface
GLFWbool ANGLE_platform_angle_opengl
GLFWbool KHR_get_all_proc_addresses
PFN_eglGetConfigAttrib GetConfigAttrib
GLFWbool EXT_client_extensions