Browse Source

Platform: add Sdl2Application::Configuration::WindowFlag::{OpenGL,Vulkan}.

pull/388/head
Vladimír Vondruš 7 years ago
parent
commit
35bf229ed5
  1. 4
      doc/changelog.dox
  2. 2
      src/Magnum/Platform/Sdl2Application.cpp
  3. 28
      src/Magnum/Platform/Sdl2Application.h

4
doc/changelog.dox

@ -298,6 +298,10 @@ See also:
in @ref Platform::GlfwApplication and @ref Platform::EmscriptenApplication) in @ref Platform::GlfwApplication and @ref Platform::EmscriptenApplication)
for changing window title at runtime as opposed to setting them on for changing window title at runtime as opposed to setting them on
application startup application startup
- Added @ref Platform::Sdl2Application::Configuration::WindowFlag::OpenGL and
@ref Platform::Sdl2Application::Configuration::WindowFlag::Vulkan "WindowFlag::Vulkan",
meant to be used together with @ref Platform::Sdl2Application::Configuration::WindowFlag::Contextless for
manual creation of OpenGL contexts and Vulkan instances
- @ref Platform::WindowlessEglApplication now uses the - @ref Platform::WindowlessEglApplication now uses the
@m_class{m-doc-external} [EGL_EXT_device_enumeration](https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_device_enumeration.txt), @m_class{m-doc-external} [EGL_EXT_device_enumeration](https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_device_enumeration.txt),
@m_class{m-doc-external} [EGL_EXT_platform_base](https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_platform_base.txt) and @m_class{m-doc-external} [EGL_EXT_platform_base](https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_platform_base.txt) and

2
src/Magnum/Platform/Sdl2Application.cpp

@ -295,7 +295,7 @@ bool Sdl2Application::tryCreate(const Configuration& configuration) {
#endif #endif
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
scaledWindowSize.x(), scaledWindowSize.y(), scaledWindowSize.x(), scaledWindowSize.y(),
SDL_WINDOW_ALLOW_HIGHDPI|Uint32(configuration.windowFlags() & ~Configuration::WindowFlag::Contextless)))) SDL_WINDOW_ALLOW_HIGHDPI|SDL_WINDOW_OPENGL|Uint32(configuration.windowFlags() & ~Configuration::WindowFlag::Contextless))))
{ {
Error() << "Platform::Sdl2Application::tryCreate(): cannot create window:" << SDL_GetError(); Error() << "Platform::Sdl2Application::tryCreate(): cannot create window:" << SDL_GetError();
return false; return false;

28
src/Magnum/Platform/Sdl2Application.h

@ -1415,7 +1415,28 @@ class Sdl2Application::Configuration {
* @ref tryCreate(const Configuration&) to prevent implicit * @ref tryCreate(const Configuration&) to prevent implicit
* creation of an OpenGL context. * creation of an OpenGL context.
*/ */
Contextless = 1u << 31 /* Hope this won't ever conflict with anything */ Contextless = 1u << 31, /* Hope this won't ever conflict with anything */
/**
* Request a window for use with OpenGL. Useful in combination with
* @ref WindowFlag::Contextless, otherwise enabled implicitly when
* creating an OpenGL context using @ref Sdl2Application(const Arguments&),
* @ref Sdl2Application(const Arguments, const Configuration&, const GLConfiguration&),
* @ref create(const Configuration&, const GLConfiguration&) or
* @ref tryCreate(const Configuration&, const GLConfiguration&).
*/
OpenGL = SDL_WINDOW_OPENGL,
#if !defined(CORRADE_TARGET_EMSCRIPTEN) && (SDL_MAJOR_VERSION*1000 + SDL_MINOR_VERSION*100 + SDL_PATCHLEVEL >= 2006 || defined(DOXYGEN_GENERATING_OUTPUT))
/**
* Request a window for use with Vulkan. Useful in combination with
* @ref WindowFlag::Contextless.
*
* @note Available since SDL 2.0.6, not available on
* @ref CORRADE_TARGET_EMSCRIPTEN "Emscripten".
*/
Vulkan = SDL_WINDOW_VULKAN
#endif
}; };
/** /**
@ -1429,7 +1450,10 @@ class Sdl2Application::Configuration {
SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS|SDL_WINDOW_HIDDEN| SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS|SDL_WINDOW_HIDDEN|
SDL_WINDOW_MAXIMIZED|SDL_WINDOW_MINIMIZED|SDL_WINDOW_INPUT_GRABBED| SDL_WINDOW_MAXIMIZED|SDL_WINDOW_MINIMIZED|SDL_WINDOW_INPUT_GRABBED|
#endif #endif
Uint32(WindowFlag::Contextless) Uint32(WindowFlag::Contextless)|SDL_WINDOW_OPENGL
#if !defined(CORRADE_TARGET_EMSCRIPTEN) && SDL_MAJOR_VERSION*1000 + SDL_MINOR_VERSION*100 + SDL_PATCHLEVEL >= 2006
|SDL_WINDOW_VULKAN
#endif
> WindowFlags; > WindowFlags;
#else #else
typedef Containers::EnumSet<WindowFlag> WindowFlags; typedef Containers::EnumSet<WindowFlag> WindowFlags;

Loading…
Cancel
Save