summaryrefslogtreecommitdiff
path: root/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsnativeinterface.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsnativeinterface.cpp41
1 files changed, 26 insertions, 15 deletions
diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
index 9bf4b3240c..fb1b63084f 100644
--- a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
+++ b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
@@ -43,13 +43,19 @@
#include "qwindowswindow.h"
#include "qwindowscontext.h"
-#if defined(QT_OPENGL_ES_2)
+#if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC)
# include "qwindowseglcontext.h"
# include <QtGui/QOpenGLContext>
-#elif !defined(QT_NO_OPENGL)
+#endif
+
+#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
# include "qwindowsglcontext.h"
#endif
+#if !defined(QT_NO_OPENGL)
+# include <QtGui/QOpenGLFunctions>
+#endif
+
#include <QtGui/QWindow>
QT_BEGIN_NAMESPACE
@@ -113,19 +119,24 @@ void *QWindowsNativeInterface::nativeResourceForContext(const QByteArray &resour
qWarning("%s: '%s' requested for null context or context without handle.", __FUNCTION__, resource.constData());
return 0;
}
-#ifdef QT_OPENGL_ES_2
- QWindowsEGLContext *windowsEglContext = static_cast<QWindowsEGLContext *>(context->handle());
- if (resource == QByteArrayLiteral("eglDisplay"))
- return windowsEglContext->eglDisplay();
- if (resource == QByteArrayLiteral("eglContext"))
- return windowsEglContext->eglContext();
- if (resource == QByteArrayLiteral("eglConfig"))
- return windowsEglContext->eglConfig();
-#else // QT_OPENGL_ES_2
- QWindowsGLContext *windowsContext = static_cast<QWindowsGLContext *>(context->handle());
- if (resource == QByteArrayLiteral("renderingContext"))
- return windowsContext->renderingContext();
-#endif // !QT_OPENGL_ES_2
+#if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC)
+ if (QOpenGLFunctions::isES()) {
+ QWindowsEGLContext *windowsEglContext = static_cast<QWindowsEGLContext *>(context->handle());
+ if (resource == QByteArrayLiteral("eglDisplay"))
+ return windowsEglContext->eglDisplay();
+ if (resource == QByteArrayLiteral("eglContext"))
+ return windowsEglContext->eglContext();
+ if (resource == QByteArrayLiteral("eglConfig"))
+ return windowsEglContext->eglConfig();
+ }
+#endif // QT_OPENGL_ES_2 || QT_OPENGL_DYNAMIC
+#if !defined(QT_OPENGL_ES_2)
+ if (!QOpenGLFunctions::isES()) {
+ QWindowsGLContext *windowsContext = static_cast<QWindowsGLContext *>(context->handle());
+ if (resource == QByteArrayLiteral("renderingContext"))
+ return windowsContext->renderingContext();
+ }
+#endif // QT_OPENGL_ES_2 || QT_OPENGL_DYNAMIC
qWarning("%s: Invalid key '%s' requested.", __FUNCTION__, resource.constData());
return 0;