From 87c7eea1e256c7ef1c53f1d0e2ec8b3e34bc3ae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 18 Feb 2024 13:07:27 +0100 Subject: [PATCH] Deprecate MAGNUM_TARGET_GLES3. Originally (2012? 2013?) I expected that there would eventually be OpenGL ES 4.0, thus it made sense to differentiate between ES2, ES3 and something else ES yet unknown. But as ES4 was increasingly unlikely to happen, the internal code treated MAGNUM_TARGET_GLES3 as a simple inverse of MAGNUM_TARGET_GLES2, and only in a very few places, only adding confusion. Thus it's now deprecated and defined as a simple inverse of MAGNUM_TARGET_GLES2 on MAGNUM_TARGET_GLES builds, and none of the internal code uses it anymore. --- CMakeLists.txt | 2 +- doc/changelog.dox | 5 ++ doc/cmake.dox | 6 ++- doc/opengl.dox | 6 +-- doc/portability.dox | 4 +- modules/FindMagnum.cmake | 8 +-- src/Magnum/GL/Context.cpp | 13 ++--- src/Magnum/Magnum.h | 54 +++++++++---------- src/Magnum/Platform/AndroidApplication.cpp | 2 +- src/Magnum/Platform/EmscriptenApplication.cpp | 10 ++-- src/Magnum/Platform/GlfwApplication.cpp | 6 +-- .../Implementation/EglContextHandler.cpp | 10 ++-- .../Implementation/GlxContextHandler.cpp | 6 +-- src/Magnum/Platform/Sdl2Application.cpp | 6 +-- .../Platform/WindowlessEglApplication.cpp | 8 +-- .../Platform/WindowlessGlxApplication.cpp | 6 +-- .../Platform/WindowlessWglApplication.cpp | 6 +-- src/Magnum/configure.h.cmake | 9 +++- 18 files changed, 80 insertions(+), 87 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9298ae150..fb86b18f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -594,7 +594,7 @@ endif() # Dependent configuration variables if(MAGNUM_TARGET_GLES) - if(NOT MAGNUM_TARGET_GLES2) + if(MAGNUM_BUILD_DEPRECATED AND NOT MAGNUM_TARGET_GLES2) set(MAGNUM_TARGET_GLES3 1) endif() if(CORRADE_TARGET_EMSCRIPTEN) diff --git a/doc/changelog.dox b/doc/changelog.dox index a87322b63..be5e8ebdc 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -1198,6 +1198,11 @@ See also: disabling it on GLES will force creation of a GLES context using the GLX / WGL libraries (if available); enabling it on desktop GL will allow running windowless applications on headless machines. +- The @cpp MAGNUM_TARGET_GLES3 @&e CMake and preprocessor variable existed + solely in anticipation of there eventually being OpenGL ES 4.0. That is + increasingly unlikely to happen and most of the internal code treated it as + a simple inverse of @ref MAGNUM_TARGET_GLES2, thus it's deprecated in favor + of that. - All @ref building-features "CMake build options" are now prefixed with `MAGNUM_`. For backwards compatibility, unless @ref MAGNUM_BUILD_DEPRECATED is disabled and unless a prefixed option is already set during the initial diff --git a/doc/cmake.dox b/doc/cmake.dox index eb246f081..75124d566 100644 --- a/doc/cmake.dox +++ b/doc/cmake.dox @@ -326,9 +326,9 @@ are also available as preprocessor variables if including - `MAGNUM_TARGET_GL` --- Defined if compiled with OpenGL interoperability enabled - `MAGNUM_TARGET_GLES` --- Defined if compiled for OpenGL ES -- `MAGNUM_TARGET_GLES2` --- Defined if compiled for OpenGL ES 2.0 -- `MAGNUM_TARGET_GLES3` --- Defined if compiled for OpenGL ES 3.0 - `MAGNUM_TARGET_WEBGL` --- Defined if compiled for WebGL +- `MAGNUM_TARGET_GLES2` --- Defined if compiled for OpenGL ES 2.0 / WebGL 1 + instead of OpenGL ES 3.0+ / WebGL 2 - `MAGNUM_TARGET_EGL` --- Defined if compiled for EGL instead of a platform-specific OpenGL support library such as CGL, EAGL, GLX or WGL. - `MAGNUM_TARGET_VK` --- Defined if compiled with Vulkan interoperability @@ -344,6 +344,8 @@ release: Android, Emscripten or Windows RT. Use @ref MAGNUM_TARGET_EGL instead. - `MAGNUM_TARGET_DESKTOP_GLES` --- Defined if compiled for OpenGL ES but GLX / WGL is used instead of EGL. Use @ref MAGNUM_TARGET_EGL instead. +- `MAGNUM_TARGET_GLES3` --- Defined if compiled for OpenGL ES 3.0+ / WebGL 2. + Use an inverse of the @ref MAGNUM_TARGET_GLES2 variable instead. Corrade library provides also its own set of CMake macros and variables, see @ref corrade-cmake "its documentation" for more information. diff --git a/doc/opengl.dox b/doc/opengl.dox index 39e31ff58..1d7f2e7f1 100644 --- a/doc/opengl.dox +++ b/doc/opengl.dox @@ -146,10 +146,8 @@ The following symbols are not defined when targeting OpenGL ES or WebGL. */ /** @page requires-gles30 Functionality requiring OpenGL ES 3.0 -@m_footernavigation - -@see @ref MAGNUM_TARGET_GLES3 -*/ + * @m_footernavigation + */ /** @page requires-gles31 Functionality requiring OpenGL ES 3.1 @m_footernavigation diff --git a/doc/portability.dox b/doc/portability.dox index c5fe2b715..eab5bb8ee 100644 --- a/doc/portability.dox +++ b/doc/portability.dox @@ -42,9 +42,9 @@ format is not supported. If you include @ref Magnum.h, you get these predefined macros: - @ref MAGNUM_TARGET_GLES if targeting OpenGL ES -- @ref MAGNUM_TARGET_GLES2 if targeting OpenGL ES 2.0 -- @ref MAGNUM_TARGET_GLES3 if targeting OpenGL ES 3.0 - @ref MAGNUM_TARGET_WEBGL if targeting WebGL +- @ref MAGNUM_TARGET_GLES2 if targeting OpenGL ES 2.0 / WebGL 1 instead of + OpenGL ES 3.0+ / WebGL 2 Example usage: diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index 566238990..35ca585e8 100644 --- a/modules/FindMagnum.cmake +++ b/modules/FindMagnum.cmake @@ -135,9 +135,9 @@ # globals unique even across different shared libraries # MAGNUM_TARGET_GL - Defined if compiled with OpenGL interop # MAGNUM_TARGET_GLES - Defined if compiled for OpenGL ES -# MAGNUM_TARGET_GLES2 - Defined if compiled for OpenGL ES 2.0 -# MAGNUM_TARGET_GLES3 - Defined if compiled for OpenGL ES 3.0 # MAGNUM_TARGET_WEBGL - Defined if compiled for WebGL +# MAGNUM_TARGET_GLES2 - Defined if compiled for OpenGL ES 2.0 / WebGL +# 1 instead of OpenGL ES 3.0+ / WebGL 2 # MAGNUM_TARGET_EGL - Defined if compiled for EGL instead of a # platform-specific OpenGL support library like CGL, EAGL, GLX or WGL # MAGNUM_TARGET_VK - Defined if compiled with Vulkan interop @@ -152,6 +152,8 @@ # Android, Emscripten or Windows RT. Use MAGNUM_TARGET_EGL instead. # MAGNUM_TARGET_DESKTOP_GLES` - Defined if compiled for OpenGL ES but # GLX / WGL is used instead of EGL. Use MAGNUM_TARGET_EGL instead. +# MAGNUM_TARGET_GLES3 - Defined if compiled for OpenGL ES 3.0+ / +# WebGL 2. Use an inverse of the MAGNUM_TARGET_GLES2 variable instead. # # Additionally these variables are defined for internal usage: # @@ -917,7 +919,7 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) find_package(OpenGLES2 REQUIRED) set_property(TARGET Magnum::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES OpenGLES2::OpenGLES2) - elseif(MAGNUM_TARGET_GLES3) + else() find_package(OpenGLES3 REQUIRED) set_property(TARGET Magnum::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES OpenGLES3::OpenGLES3) diff --git a/src/Magnum/GL/Context.cpp b/src/Magnum/GL/Context.cpp index 306aa345b..dbc3c880e 100644 --- a/src/Magnum/GL/Context.cpp +++ b/src/Magnum/GL/Context.cpp @@ -1137,7 +1137,7 @@ Containers::Array Context::extensionStrings() const { on GL 2.1. Happens with Mesa's zink that's just 2.1 currently (Apr 2020) even though for other backends Mesa exposes this. */ #ifndef MAGNUM_TARGET_GLES2 - #ifndef MAGNUM_TARGET_GLES3 + #ifndef MAGNUM_TARGET_GLES if(isVersionSupported(Version::GL300)) #endif { @@ -1148,14 +1148,15 @@ Containers::Array Context::extensionStrings() const { extensions[i] = {reinterpret_cast(glGetStringi(GL_EXTENSIONS, i)), Containers::StringViewFlag::Global}; return extensions; } - #ifndef MAGNUM_TARGET_GLES3 + #ifndef MAGNUM_TARGET_GLES else #endif #endif - - #ifndef MAGNUM_TARGET_GLES3 - /* OpenGL 2.1 / OpenGL ES 2.0 doesn't have glGetStringi() */ - return Containers::StringView{reinterpret_cast(glGetString(GL_EXTENSIONS)), Containers::StringViewFlag::Global}.splitOnWhitespaceWithoutEmptyParts(); + #if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_GLES2) + { + /* OpenGL 2.1 / OpenGL ES 2.0 doesn't have glGetStringi() */ + return Containers::StringView{reinterpret_cast(glGetString(GL_EXTENSIONS)), Containers::StringViewFlag::Global}.splitOnWhitespaceWithoutEmptyParts(); + } #endif } diff --git a/src/Magnum/Magnum.h b/src/Magnum/Magnum.h index 57b556839..118411bdb 100644 --- a/src/Magnum/Magnum.h +++ b/src/Magnum/Magnum.h @@ -139,7 +139,7 @@ Enabled by default in a static build. On Windows see also the Defined if the engine is built with OpenGL interoperability enabled --- extra APIs in various libraries interacting with the @ref Magnum::GL "GL" library. Enabled by default in case the @ref Magnum::GL "GL" library is built. -@see @ref MAGNUM_TARGET_GLES2, @ref MAGNUM_TARGET_GLES3, +@see @ref MAGNUM_TARGET_GLES, @ref MAGNUM_TARGET_GLES2, @ref MAGNUM_TARGET_EGL, @ref building, @ref cmake */ #define MAGNUM_TARGET_GL @@ -149,47 +149,45 @@ Enabled by default in case the @ref Magnum::GL "GL" library is built. @brief OpenGL ES target Defined if the engine is built for OpenGL ES 3.0 or OpenGL ES 2.0. -@see @ref MAGNUM_TARGET_GLES2, @ref MAGNUM_TARGET_GLES3, - @ref MAGNUM_TARGET_EGL, @ref building, @ref cmake +@see @ref MAGNUM_TARGET_GLES2, @ref MAGNUM_TARGET_EGL, @ref building, + @ref cmake */ #define MAGNUM_TARGET_GLES #undef MAGNUM_TARGET_GLES /** -@brief OpenGL ES 2.0 target +@brief WebGL target -Defined if the engine is built for OpenGL ES 2.0. Implies also -@ref MAGNUM_TARGET_GLES. -@see @ref MAGNUM_TARGET_GLES3, @ref MAGNUM_TARGET_EGL, @ref building, - @ref cmake +Defined if the engine is built for WebGL (using Emscripten). WebGL 1 is nearly +equivalent to OpenGL ES 2.0 and WebGL 2 to OpenGL ES 3.0, thus in most cases +you don't need to treat it differently, but there are some specific +restrictions and differences [compared to OpenGL ES 2.0](http://www.khronos.org/registry/webgl/specs/latest/1.0/#6) +and to [OpenGL ES 3.0](https://registry.khronos.org/webgl/specs/latest/2.0/#5) +which you might want to be aware of. Implies also @ref MAGNUM_TARGET_GLES. +@see @ref MAGNUM_TARGET_GLES2 @ref CORRADE_TARGET_EMSCRIPTEN, @ref building, @ref cmake */ -#define MAGNUM_TARGET_GLES2 -#undef MAGNUM_TARGET_GLES2 +#define MAGNUM_TARGET_WEBGL +#undef MAGNUM_TARGET_WEBGL /** -@brief OpenGL ES 3.0 target +@brief OpenGL ES 2.0 / WebGL 1.0 target -Defined if the engine is built for OpenGL ES 3.0. Implies also -@ref MAGNUM_TARGET_GLES. -@see @ref MAGNUM_TARGET_GLES2, @ref MAGNUM_TARGET_EGL, @ref building, - @ref cmake +Defined if the engine is built for OpenGL ES 2.0 / WebGL 1.0 instead of OpenGL +ES 3.0+ / WebGL 2. Implies also @ref MAGNUM_TARGET_GLES. +@see @ref MAGNUM_TARGET_EGL, @ref building, @ref cmake */ -#define MAGNUM_TARGET_GLES3 -#undef MAGNUM_TARGET_GLES3 +#define MAGNUM_TARGET_GLES2 +#undef MAGNUM_TARGET_GLES2 +#ifdef MAGNUM_BUILD_DEPRECATED /** -@brief WebGL target - -Defined if the engine is built for WebGL (using Emscripten). WebGL is nearly -equivalent to OpenGL ES 2.0, thus in most cases you don't need to treat it -differently, but there are some -[specific restrictions and features](http://www.khronos.org/registry/webgl/specs/latest/1.0/#6) -which you might want to be aware of. Implies also @ref MAGNUM_TARGET_GLES and -@ref MAGNUM_TARGET_GLES2. -@see @ref CORRADE_TARGET_EMSCRIPTEN, @ref building, @ref cmake +@brief OpenGL ES 3.0+ / WebGL 2.0 target +@m_deprecated_since_latest This macro is simply an inverse of + @ref MAGNUM_TARGET_GLES2, use that one instead. */ -#define MAGNUM_TARGET_WEBGL -#undef MAGNUM_TARGET_WEBGL +#define MAGNUM_TARGET_GLES3 +#undef MAGNUM_TARGET_GLES3 +#endif /** @brief EGL target diff --git a/src/Magnum/Platform/AndroidApplication.cpp b/src/Magnum/Platform/AndroidApplication.cpp index 940e61892..01578945e 100644 --- a/src/Magnum/Platform/AndroidApplication.cpp +++ b/src/Magnum/Platform/AndroidApplication.cpp @@ -153,7 +153,7 @@ bool AndroidApplication::tryCreate(const Configuration& configuration, const GLC const EGLint contextAttributes[] = { #ifdef MAGNUM_TARGET_GLES2 EGL_CONTEXT_CLIENT_VERSION, 2, - #elif defined(MAGNUM_TARGET_GLES3) + #elif defined(MAGNUM_TARGET_GLES) EGL_CONTEXT_CLIENT_VERSION, 3, #else #error Android with desktop OpenGL? Wow, that is a new thing. diff --git a/src/Magnum/Platform/EmscriptenApplication.cpp b/src/Magnum/Platform/EmscriptenApplication.cpp index fcf46b306..9901e12cb 100644 --- a/src/Magnum/Platform/EmscriptenApplication.cpp +++ b/src/Magnum/Platform/EmscriptenApplication.cpp @@ -373,12 +373,10 @@ bool EmscriptenApplication::tryCreate(const Configuration& configuration, const attrs.enableExtensionsByDefault = !!(glConfiguration.flags() & GLConfiguration::Flag::EnableExtensionsByDefault); - #ifdef MAGNUM_TARGET_GLES3 /* WebGL 2 */ - attrs.majorVersion = 2; - #elif defined(MAGNUM_TARGET_GLES2) /* WebGL 1 */ - attrs.minorVersion = 1; - #else - #error unsupported OpenGL ES version + #ifdef MAGNUM_TARGET_GLES2 /* WebGL 1 */ + attrs.majorVersion = 1; + #else /* WebGL 2 */ + attrs.minorVersion = 2; #endif std::ostream* verbose = _verboseLog ? Debug::output() : nullptr; diff --git a/src/Magnum/Platform/GlfwApplication.cpp b/src/Magnum/Platform/GlfwApplication.cpp index 4ac3188ed..30523f376 100644 --- a/src/Magnum/Platform/GlfwApplication.cpp +++ b/src/Magnum/Platform/GlfwApplication.cpp @@ -494,12 +494,10 @@ bool GlfwApplication::tryCreate(const Configuration& configuration, const GLConf glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, glFlags >= GLConfiguration::Flag::ForwardCompatible); #else /* For ES the major context version is compile-time constant */ - #ifdef MAGNUM_TARGET_GLES3 - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); - #elif defined(MAGNUM_TARGET_GLES2) + #ifdef MAGNUM_TARGET_GLES2 glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); #else - #error unsupported OpenGL ES version + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); #endif glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API); diff --git a/src/Magnum/Platform/Implementation/EglContextHandler.cpp b/src/Magnum/Platform/Implementation/EglContextHandler.cpp index ff678f668..ec15c945a 100644 --- a/src/Magnum/Platform/Implementation/EglContextHandler.cpp +++ b/src/Magnum/Platform/Implementation/EglContextHandler.cpp @@ -67,12 +67,10 @@ VisualId EglContextHandler::getVisualId(EGLNativeDisplayType nativeDisplay) { EGL_DEPTH_SIZE, 1, #ifndef MAGNUM_TARGET_GLES EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, - #elif defined(MAGNUM_TARGET_GLES3) - EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT_KHR, #elif defined(MAGNUM_TARGET_GLES2) EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, #else - #error unsupported OpenGL edition + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT_KHR, #endif EGL_NONE }; @@ -130,12 +128,10 @@ void EglContextHandler::createContext(const AbstractXApplication::GLConfiguratio #ifdef MAGNUM_TARGET_GLES else { attributes[0] = EGL_CONTEXT_CLIENT_VERSION; - #ifdef MAGNUM_TARGET_GLES3 - attributes[1] = 3; - #elif defined(MAGNUM_TARGET_GLES2) + #ifdef MAGNUM_TARGET_GLES2 attributes[1] = 2; #else - #error unsupported OpenGL ES version + attributes[1] = 3; #endif } #endif diff --git a/src/Magnum/Platform/Implementation/GlxContextHandler.cpp b/src/Magnum/Platform/Implementation/GlxContextHandler.cpp index 62d64d0c8..9df39664b 100644 --- a/src/Magnum/Platform/Implementation/GlxContextHandler.cpp +++ b/src/Magnum/Platform/Implementation/GlxContextHandler.cpp @@ -107,12 +107,10 @@ void GlxContextHandler::createContext(const AbstractXApplication::GLConfiguratio #ifdef MAGNUM_TARGET_GLES else { attributes[0] = GLX_CONTEXT_MAJOR_VERSION_ARB; - #ifdef MAGNUM_TARGET_GLES3 - attributes[1] = 3; - #elif defined(MAGNUM_TARGET_GLES2) + #ifdef MAGNUM_TARGET_GLES2 attributes[1] = 2; #else - #error unsupported OpenGL ES version + attributes[1] = 3; #endif attributes[2] = GLX_CONTEXT_MINOR_VERSION_ARB; attributes[3] = 0; diff --git a/src/Magnum/Platform/Sdl2Application.cpp b/src/Magnum/Platform/Sdl2Application.cpp index 64bb91c54..4b41f6821 100644 --- a/src/Magnum/Platform/Sdl2Application.cpp +++ b/src/Magnum/Platform/Sdl2Application.cpp @@ -549,12 +549,10 @@ bool Sdl2Application::tryCreate(const Configuration& configuration, const GLConf SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, int(UnsignedLong(glFlags) & 0xffffffffu)); #else /* For ES the major context version is compile-time constant */ - #ifdef MAGNUM_TARGET_GLES3 - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); - #elif defined(MAGNUM_TARGET_GLES2) + #ifdef MAGNUM_TARGET_GLES2 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); #else - #error unsupported OpenGL ES version + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); #endif SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); diff --git a/src/Magnum/Platform/WindowlessEglApplication.cpp b/src/Magnum/Platform/WindowlessEglApplication.cpp index db759db19..71626f6f1 100644 --- a/src/Magnum/Platform/WindowlessEglApplication.cpp +++ b/src/Magnum/Platform/WindowlessEglApplication.cpp @@ -337,10 +337,8 @@ WindowlessEglContext::WindowlessEglContext(const Configuration& configuration, G the `-s USE_WEBGL2=1` flag anyway, so it doesn't matter that we ask for ES2 on WebGL 2 as well. */ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, - #elif defined(MAGNUM_TARGET_GLES3) - EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT_KHR, #else - #error unsupported OpenGL edition + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT_KHR, #endif EGL_NONE }; @@ -376,10 +374,8 @@ WindowlessEglContext::WindowlessEglContext(const Configuration& configuration, G anyway, so it doesn't matter that we ask for ES2 on WebGL 2 as well. https://github.com/emscripten-core/emscripten/pull/7858 */ 2, - #elif defined(MAGNUM_TARGET_GLES3) - 3, #else - #error unsupported OpenGL ES version + 3, #endif #else 3, diff --git a/src/Magnum/Platform/WindowlessGlxApplication.cpp b/src/Magnum/Platform/WindowlessGlxApplication.cpp index acfcd7476..f553e17b7 100644 --- a/src/Magnum/Platform/WindowlessGlxApplication.cpp +++ b/src/Magnum/Platform/WindowlessGlxApplication.cpp @@ -123,12 +123,10 @@ WindowlessGlxContext::WindowlessGlxContext(const WindowlessGlxContext::Configura /* Optimistically choose core context first */ GLint contextAttributes[11] = { #ifdef MAGNUM_TARGET_GLES - #ifdef MAGNUM_TARGET_GLES3 - GLX_CONTEXT_MAJOR_VERSION_ARB, 3, - #elif defined(MAGNUM_TARGET_GLES2) + #ifdef MAGNUM_TARGET_GLES2 GLX_CONTEXT_MAJOR_VERSION_ARB, 2, #else - #error unsupported OpenGL ES version + GLX_CONTEXT_MAJOR_VERSION_ARB, 3, #endif GLX_CONTEXT_MINOR_VERSION_ARB, 0, GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_ES2_PROFILE_BIT_EXT, diff --git a/src/Magnum/Platform/WindowlessWglApplication.cpp b/src/Magnum/Platform/WindowlessWglApplication.cpp index 9d28fa41b..150a63d67 100644 --- a/src/Magnum/Platform/WindowlessWglApplication.cpp +++ b/src/Magnum/Platform/WindowlessWglApplication.cpp @@ -136,12 +136,10 @@ WindowlessWglContext::WindowlessWglContext(const Configuration& configuration, G /* Optimistically choose core context first */ GLint contextAttributes[11] = { #ifdef MAGNUM_TARGET_GLES - #ifdef MAGNUM_TARGET_GLES3 - WGL_CONTEXT_MAJOR_VERSION_ARB, 3, - #elif defined(MAGNUM_TARGET_GLES2) + #ifdef MAGNUM_TARGET_GLES2 WGL_CONTEXT_MAJOR_VERSION_ARB, 2, #else - #error unsupported OpenGL ES version + WGL_CONTEXT_MAJOR_VERSION_ARB, 3, #endif WGL_CONTEXT_MINOR_VERSION_ARB, 0, WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_ES2_PROFILE_BIT_EXT, diff --git a/src/Magnum/configure.h.cmake b/src/Magnum/configure.h.cmake index 2feecda87..abb56b1b3 100644 --- a/src/Magnum/configure.h.cmake +++ b/src/Magnum/configure.h.cmake @@ -31,7 +31,6 @@ #cmakedefine MAGNUM_TARGET_GL #cmakedefine MAGNUM_TARGET_GLES #cmakedefine MAGNUM_TARGET_GLES2 -#cmakedefine MAGNUM_TARGET_GLES3 #cmakedefine MAGNUM_TARGET_WEBGL #cmakedefine MAGNUM_TARGET_EGL #cmakedefine MAGNUM_TARGET_VK @@ -61,6 +60,14 @@ #define MAGNUM_TARGET_DESKTOP_GLES #endif #endif +/* MAGNUM_TARGET_GLES3 used to be an inverse of MAGNUM_TARGET_GLES2 in an + anticipation of there eventually being GLES 4. Used very rarely in the + internals and only led to confusion. Deliberate double space after the + #define to avoid being unconditionally matched by older FindMagnum + modules. */ +#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_GLES2) +#define MAGNUM_TARGET_GLES3 +#endif #endif #endif // kate: hl c++