diff options
Diffstat (limited to 'src/gui/kernel/qplatformopenglcontext.h')
-rw-r--r-- | src/gui/kernel/qplatformopenglcontext.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/gui/kernel/qplatformopenglcontext.h b/src/gui/kernel/qplatformopenglcontext.h index f307cc14f9..8c38d88b56 100644 --- a/src/gui/kernel/qplatformopenglcontext.h +++ b/src/gui/kernel/qplatformopenglcontext.h @@ -57,6 +57,7 @@ #include <QtGui/qsurfaceformat.h> #include <QtGui/qwindow.h> #include <QtGui/qopengl.h> +#include <QtGui/qopenglcontext.h> QT_BEGIN_NAMESPACE @@ -92,6 +93,7 @@ public: private: friend class QOpenGLContext; + friend class QOpenGLContextPrivate; QScopedPointer<QPlatformOpenGLContextPrivate> d_ptr; @@ -100,6 +102,49 @@ private: Q_DISABLE_COPY(QPlatformOpenGLContext) }; +template <typename T> +T *QOpenGLContext::platformInterface() const +{ + return dynamic_cast<T*>(handle()); +} + +namespace QPlatformInterface::Private { + +#if defined(Q_OS_MACOS) +struct Q_GUI_EXPORT QCocoaGLIntegration +{ + QT_DECLARE_PLATFORM_INTERFACE(QCocoaGLIntegration) + virtual QOpenGLContext *createOpenGLContext(NSOpenGLContext *, QOpenGLContext *shareContext) const = 0; +}; +#endif + +#if defined(Q_OS_WIN) +struct Q_GUI_EXPORT QWindowsGLIntegration +{ + QT_DECLARE_PLATFORM_INTERFACE(QWindowsGLIntegration) + virtual HMODULE openGLModuleHandle() const = 0; + virtual QOpenGLContext *createOpenGLContext(HGLRC context, HWND window, QOpenGLContext *shareContext) const = 0; +}; +#endif + +#if defined(Q_OS_LINUX) +struct Q_GUI_EXPORT QGLXIntegration +{ + QT_DECLARE_PLATFORM_INTERFACE(QGLXIntegration) + virtual QOpenGLContext *createOpenGLContext(GLXContext context, void *visualInfo, QOpenGLContext *shareContext) const = 0; +}; +#endif + +#if QT_CONFIG(egl) +struct Q_GUI_EXPORT QEGLIntegration +{ + QT_DECLARE_PLATFORM_INTERFACE(QEGLIntegration) + virtual QOpenGLContext *createOpenGLContext(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext) const = 0; +}; +#endif + +} // QPlatformInterface::Private + QT_END_NAMESPACE #endif // QT_NO_OPENGL |