Browse Source

[WindowLessApps]: add release option to contexts [egl,cgl,glx for linux]

pull/495/head
Konstantinos Chatzilygeroudis 5 years ago
parent
commit
4771ae9fb8
  1. 8
      src/Magnum/Platform/WindowlessCglApplication.cpp
  2. 8
      src/Magnum/Platform/WindowlessCglApplication.h
  3. 10
      src/Magnum/Platform/WindowlessEglApplication.cpp
  4. 8
      src/Magnum/Platform/WindowlessEglApplication.h
  5. 8
      src/Magnum/Platform/WindowlessGlxApplication.cpp
  6. 8
      src/Magnum/Platform/WindowlessGlxApplication.h

8
src/Magnum/Platform/WindowlessCglApplication.cpp

@ -97,6 +97,14 @@ bool WindowlessCglContext::makeCurrent() {
return false;
}
bool WindowlessCglContext::release() {
if(CGLSetCurrentContext(0) == kCGLNoError)
return true;
Error() << "Platform::WindowlessCglContext::release(): cannot release current context";
return false;
}
#ifndef DOXYGEN_GENERATING_OUTPUT
WindowlessCglApplication::WindowlessCglApplication(const Arguments& arguments): WindowlessCglApplication{arguments, Configuration{}} {}
#endif

8
src/Magnum/Platform/WindowlessCglApplication.h

@ -126,6 +126,14 @@ class WindowlessCglContext {
*/
bool makeCurrent();
/**
* @brief Release current context
*
* Prints error message and returns @cpp false @ce on failure,
* otherwise returns @cpp true @ce.
*/
bool release();
/**
* @brief Underlying OpenGL context
* @m_since{2020,06}

10
src/Magnum/Platform/WindowlessEglApplication.cpp

@ -503,7 +503,15 @@ bool WindowlessEglContext::makeCurrent() {
return true;
#endif
Error() << "Platform::WindowlessEglApplication::tryCreateContext(): cannot make context current:" << Implementation::eglErrorString(eglGetError());
Error() << "Platform::WindowlessEglApplication::makeCurrent(): cannot make context current:" << Implementation::eglErrorString(eglGetError());
return false;
}
bool WindowlessEglContext::release() {
if(eglMakeCurrent(_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT))
return true;
Error() << "Platform::WindowlessEglApplication::release(): cannot release current context:" << Implementation::eglErrorString(eglGetError());
return false;
}

8
src/Magnum/Platform/WindowlessEglApplication.h

@ -127,6 +127,14 @@ class WindowlessEglContext {
*/
bool makeCurrent();
/**
* @brief Release current context
*
* Prints error message and returns @cpp false @ce on failure,
* otherwise returns @cpp true @ce.
*/
bool release();
/**
* @brief Underlying OpenGL context
* @m_since{2020,06}

8
src/Magnum/Platform/WindowlessGlxApplication.cpp

@ -255,6 +255,14 @@ bool WindowlessGlxContext::makeCurrent() {
return false;
}
bool WindowlessGlxContext::release() {
if(glXMakeContextCurrent(_display, 0, 0, nullptr))
return true;
Error() << "Platform::WindowlessGlxContext::release(): cannot release current context";
return false;
}
WindowlessGlxContext::Configuration::Configuration():
#ifndef MAGNUM_TARGET_GLES
_flags{Flag::ForwardCompatible}

8
src/Magnum/Platform/WindowlessGlxApplication.h

@ -146,6 +146,14 @@ class WindowlessGlxContext {
*/
bool makeCurrent();
/**
* @brief Release current context
*
* Prints error message and returns @cpp false @ce on failure,
* otherwise returns @cpp true @ce.
*/
bool release();
/**
* @brief Underlying OpenGL context
* @m_since{2020,06}

Loading…
Cancel
Save