diff --git a/src/Magnum/Platform/WindowlessCglApplication.h b/src/Magnum/Platform/WindowlessCglApplication.h index 6d453a6ef..5716b4cd8 100644 --- a/src/Magnum/Platform/WindowlessCglApplication.h +++ b/src/Magnum/Platform/WindowlessCglApplication.h @@ -126,6 +126,17 @@ class WindowlessCglContext { */ bool makeCurrent(); + /** + * @brief Underlying OpenGL context + * @m_since_latest + * + * Use in case you need to call CGL functionality directly or in order + * to create a shared context. Returns @cpp nullptr @ce in case the + * context was not created yet. + * @see @ref Configuration::setSharedContext() + */ + CGLContextObj glContext() { return _context; } + private: CGLPixelFormatObj _pixelFormat{}; CGLContextObj _context{}; @@ -153,6 +164,8 @@ class WindowlessCglContext::Configuration { * limitations apply to shared OpenGL contexts, please consult the * OpenGL specification for details. Default is @cpp nullptr @ce, i.e. * no sharing. + * @see @ref WindowlessCglContext::glContext(), + * @ref WindowlessCglApplication::glContext() */ Configuration& setSharedContext(CGLContextObj context) { _sharedContext = context; @@ -314,6 +327,17 @@ class WindowlessCglApplication { */ virtual int exec() = 0; + /** + * @brief Underlying OpenGL context + * @m_since_latest + * + * Use in case you need to call CGL functionality directly or in order + * to create a shared context. Returns @cpp nullptr @ce in case the + * context was not created yet. + * @see @ref Configuration::setSharedContext() + */ + CGLContextObj glContext() { return _glContext.glContext(); } + protected: /* Nobody will need to have (and delete) WindowlessCglApplication*, thus this is faster than public pure virtual destructor */ diff --git a/src/Magnum/Platform/WindowlessEglApplication.h b/src/Magnum/Platform/WindowlessEglApplication.h index af0681dd9..bc023f85b 100644 --- a/src/Magnum/Platform/WindowlessEglApplication.h +++ b/src/Magnum/Platform/WindowlessEglApplication.h @@ -120,6 +120,17 @@ class WindowlessEglContext { */ bool makeCurrent(); + /** + * @brief Underlying OpenGL context + * @m_since_latest + * + * Use in case you need to call EGL functionality directly or in order + * to create a shared context. Returns @cpp nullptr @ce in case the + * context was not created yet. + * @see @ref Configuration::setSharedContext() + */ + EGLContext glContext() { return _context; } + private: EGLDisplay _display{}; EGLContext _context{}; @@ -266,6 +277,8 @@ class WindowlessEglContext::Configuration { * limitations apply to shared OpenGL contexts, please consult the * OpenGL specification for details. Default is `EGL_NO_CONTEXT`, i.e. * no sharing. + * @see @ref WindowlessEglContext::glContext(), + * @ref WindowlessEglApplication::glContext() * @requires_gles Context sharing is not available in WebGL. */ Configuration& setSharedContext(EGLContext context) { @@ -521,6 +534,17 @@ class WindowlessEglApplication { */ virtual int exec() = 0; + /** + * @brief Underlying OpenGL context + * @m_since_latest + * + * Use in case you need to call EGL functionality directly or in order + * to create a shared context. Returns @cpp nullptr @ce in case the + * context was not created yet. + * @see @ref Configuration::setSharedContext() + */ + EGLContext glContext() { return _glContext.glContext(); } + protected: /* Nobody will need to have (and delete) WindowlessEglApplication*, thus this is faster than public pure virtual destructor */ diff --git a/src/Magnum/Platform/WindowlessGlxApplication.h b/src/Magnum/Platform/WindowlessGlxApplication.h index 792cbd99e..0d07ac4c8 100644 --- a/src/Magnum/Platform/WindowlessGlxApplication.h +++ b/src/Magnum/Platform/WindowlessGlxApplication.h @@ -140,6 +140,17 @@ class WindowlessGlxContext { */ bool makeCurrent(); + /** + * @brief Underlying OpenGL context + * @m_since_latest + * + * Use in case you need to call GLX functionality directly or in order + * to create a shared context. Returns @cpp nullptr @ce in case the + * context was not created yet. + * @see @ref Configuration::setSharedContext() + */ + GLXContext glContext() { return _context; } + private: Display* _display{}; GLXPbuffer _pbuffer{}; @@ -249,6 +260,8 @@ class WindowlessGlxContext::Configuration { * limitations apply to shared OpenGL contexts, please consult the * OpenGL specification for details. Default is @cpp nullptr @ce, i.e. * no sharing. + * @see @ref WindowlessGlxContext::glContext(), + * @ref WindowlessGlxApplication::glContext() */ Configuration& setSharedContext(GLXContext ctx) { _sharedContext = ctx; @@ -416,6 +429,17 @@ class WindowlessGlxApplication { */ virtual int exec() = 0; + /** + * @brief Underlying OpenGL context + * @m_since_latest + * + * Use in case you need to call GLX functionality directly or in order + * to create a shared context. Returns @cpp nullptr @ce in case the + * context was not created yet. + * @see @ref Configuration::setSharedContext() + */ + GLXContext glContext() { return _glContext.glContext(); } + protected: /* Nobody will need to have (and delete) WindowlessGlxApplication*, thus this is faster than public pure virtual destructor */ diff --git a/src/Magnum/Platform/WindowlessWglApplication.h b/src/Magnum/Platform/WindowlessWglApplication.h index f63040df7..81c036f21 100644 --- a/src/Magnum/Platform/WindowlessWglApplication.h +++ b/src/Magnum/Platform/WindowlessWglApplication.h @@ -134,6 +134,17 @@ class WindowlessWglContext { */ bool makeCurrent(); + /** + * @brief Underlying OpenGL context + * @m_since_latest + * + * Use in case you need to call WGL functionality directly or in order + * to create a shared context. Returns @cpp nullptr @ce in case the + * context was not created yet. + * @see @ref Configuration::setSharedContext() + */ + HGLRC glContext() { return _context; } + private: HWND _window{}; HDC _deviceContext{}; @@ -243,6 +254,8 @@ class WindowlessWglContext::Configuration { * limitations apply to shared OpenGL contexts, please consult the * OpenGL specification for details. Default is @cpp nullptr @ce, i.e. * no sharing. + * @see @ref WindowlessWglContext::glContext(), + * @ref WindowlessWglApplication::glContext() */ Configuration& setSharedContext(HGLRC context) { _sharedContext = context; @@ -408,6 +421,17 @@ class WindowlessWglApplication { */ virtual int exec() = 0; + /** + * @brief Underlying OpenGL context + * @m_since_latest + * + * Use in case you need to call WGL functionality directly or in order + * to create a shared context. Returns @cpp nullptr @ce in case the + * context was not created yet. + * @see @ref Configuration::setSharedContext() + */ + HGLRC glContext() { return _glContext.glContext(); } + protected: /* Nobody will need to have (and delete) WindowlessWglApplication*, thus this is faster than public pure virtual destructor */ diff --git a/src/Magnum/Platform/WindowlessWindowsEglApplication.h b/src/Magnum/Platform/WindowlessWindowsEglApplication.h index baae48b0e..012380223 100644 --- a/src/Magnum/Platform/WindowlessWindowsEglApplication.h +++ b/src/Magnum/Platform/WindowlessWindowsEglApplication.h @@ -119,6 +119,17 @@ class WindowlessWindowsEglContext { */ bool makeCurrent(); + /** + * @brief Underlying OpenGL context + * @m_since_latest + * + * Use in case you need to call EGL functionality directly or in order + * to create a shared context. Returns @cpp nullptr @ce in case the + * context was not created yet. + * @see @ref Configuration::setSharedContext() + */ + EGLContext glContext() { return _context; } + private: HWND _window{}; EGLDisplay _display{}; @@ -213,6 +224,8 @@ class WindowlessWindowsEglContext::Configuration { * limitations apply to shared OpenGL contexts, please consult the * OpenGL specification for details. Default is `EGL_NO_CONTEXT`, i.e. * no sharing. + * @see @ref WindowlessWindowsEglContext::glContext(), + * @ref WindowlessWindowsEglApplication::glContext() */ Configuration& setSharedContext(EGLContext context) { _sharedContext = context; @@ -378,6 +391,17 @@ class WindowlessWindowsEglApplication { */ virtual int exec() = 0; + /** + * @brief Underlying OpenGL context + * @m_since_latest + * + * Use in case you need to call EGL functionality directly or in order + * to create a shared context. Returns @cpp nullptr @ce in case the + * context was not created yet. + * @see @ref Configuration::setSharedContext() + */ + EGLContext glContext() { return _glContext.glContext(); } + protected: /* Nobody will need to have (and delete) WindowlessWindowsEglApplication*, thus this is faster than public pure virtual destructor */