Browse Source

Added WindowlessEGLApplication shared context support

pull/433/head
Stéphane Brard 6 years ago
parent
commit
8605861f69
  1. 2
      src/Magnum/Platform/WindowlessEglApplication.cpp
  2. 18
      src/Magnum/Platform/WindowlessEglApplication.h

2
src/Magnum/Platform/WindowlessEglApplication.cpp

@ -273,7 +273,7 @@ WindowlessEglContext::WindowlessEglContext(const Configuration& configuration, G
}
#endif
if(!(_context = eglCreateContext(_display, config, EGL_NO_CONTEXT, attributes))) {
if(!(_context = eglCreateContext(_display, config, configuration.sharedContext(), attributes))) {
Error() << "Platform::WindowlessEglApplication::tryCreateContext(): cannot create EGL context:" << Implementation::eglErrorString(eglGetError());
return;
}

18
src/Magnum/Platform/WindowlessEglApplication.h

@ -255,10 +255,28 @@ class WindowlessEglContext::Configuration {
_device = id;
return *this;
}
/**
* @brief Creates an OpenGL shared context with @param ctx instead
* of creating a brand new one.
*/
Configuration& setSharedcontext(EGLContext ctx) {
_sharedContext = ctx;
return *this;
}
/**
* @brief Returns the configuration shared context.
* If this has not been specified, (meaning the configuration uses a new opengl context),
* then returns nullptr
*/
EGLContext sharedContext() const {
return _sharedContext;
}
#endif
private:
#ifndef MAGNUM_TARGET_WEBGL
EGLContext _sharedContext{EGL_NO_CONTEXT};
Flags _flags;
UnsignedInt _device;
#endif

Loading…
Cancel
Save