From e9ebb4341944390d375b9516eed51a12a95f7952 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 3 Mar 2014 18:20:51 +0100 Subject: Dynamic GL: Query gl handle and type via the native interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I7ca5beaeb57ee2e4e9c175f53ac32371d1f6b5ed Reviewed-by: Friedemann Kleint Reviewed-by: Jørgen Lind --- src/gui/kernel/qopenglcontext.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/gui/kernel/qopenglcontext.cpp') diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 357beb4e245..005f716788f 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -969,13 +970,21 @@ void QOpenGLContext::deleteQGLContext() The library might be GL-only, meaning that windowing system interface functions (for example EGL) may live in another, separate library. + \note This function requires that the QGuiApplication instance is already created. + \sa openGLModuleType() \since 5.3 */ void *QOpenGLContext::openGLModuleHandle() { +#ifdef QT_OPENGL_DYNAMIC + QGuiApplication *app = qGuiApp; + Q_ASSERT(app); + return app->platformNativeInterface()->nativeResourceForIntegration(QByteArrayLiteral("glhandle")); +#else return 0; +#endif } /*! @@ -1001,11 +1010,16 @@ void *QOpenGLContext::openGLModuleHandle() appropriate to check QSurfaceFormat::renderableType() or using the the convenience function isES(). + \note This function requires that the QGuiApplication instance is already created. + \since 5.3 */ QOpenGLContext::OpenGLModuleType QOpenGLContext::openGLModuleType() { -#if defined(QT_OPENGL_ES_2) +#if defined(QT_OPENGL_DYNAMIC) + Q_ASSERT(qGuiApp); + return QGuiApplicationPrivate::instance()->platformIntegration()->openGLModuleType(); +#elif defined(QT_OPENGL_ES_2) return GLES2; #elif defined(QT_OPENGL_ES) return GLES1; -- cgit v1.2.3