diff --git a/docs/compile.dox b/docs/compile.dox index 1b4ce218..30271358 100644 --- a/docs/compile.dox +++ b/docs/compile.dox @@ -281,6 +281,12 @@ available: - `_GLFW_USE_RETINA` to have windows use the full resolution of Retina displays (recommended) +If you are using the EGL context creation API, the following options are +available: + + - `_GLFW_USE_EGLPLATFORM_H` to use `EGL/eglplatform.h` for native handle + definitions (fallback) + @note None of the @ref build_macros may be defined during the compilation of GLFW. If you define any of these in your build files, make sure they are not applied to the GLFW sources. diff --git a/src/egl_context.h b/src/egl_context.h index 22cbdf38..660019dd 100644 --- a/src/egl_context.h +++ b/src/egl_context.h @@ -39,7 +39,27 @@ #define _glfw_dlsym(handle, name) dlsym(handle, name) #endif -#include +#if defined(_GLFW_USE_EGLPLATFORM_H) + #include +#elif defined(_GLFW_WIN32) + #define EGLAPIENTRY __stdcall +typedef HDC EGLNativeDisplayType; +typedef HWND EGLNativeWindowType; +#elif defined(_GLFW_X11) + #define EGLAPIENTRY +typedef Display* EGLNativeDisplayType; +typedef Window EGLNativeWindowType; +#elif defined(_GLFW_WAYLAND) + #define EGLAPIENTRY +typedef struct wl_display* EGLNativeDisplayType; +typedef struct wl_egl_window* EGLNativeWindowType; +#elif defined(_GLFW_MIR) + #define EGLAPIENTRY +typedef MirEGLNativeDisplayType EGLNativeDisplayType; +typedef MirEGLNativeWindowType EGLNativeWindowType; +#else + #error "No supported EGL platform selected" +#endif #define EGL_SUCCESS 0x3000 #define EGL_NOT_INITIALIZED 0x3001 @@ -94,6 +114,7 @@ #define EGL_NO_DISPLAY ((EGLDisplay) 0) #define EGL_NO_CONTEXT ((EGLContext) 0) +typedef int EGLint; typedef unsigned int EGLBoolean; typedef unsigned int EGLenum; typedef void* EGLConfig;