summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorAndrew Knight <andrew.knight@digia.com>2013-11-22 09:18:59 +0200
committerAndrew Knight <andrew.knight@digia.com>2013-11-25 09:11:17 +0100
commit88b13ef7d8c7487f13cfa431b2ef0e9d0d1f2636 (patch)
tree133ffce92f34b52b9cc7939cf486e236b32427f2 /src/plugins/platforms
parent26bdc66fe6c4499332b2ead886a806d09aa07a8a (diff)
Wayland-EGL QPA: Support desktop OpenGL as well
There is no hard requirement on OpenGL ES 2 in this plugin, so allow Desktop OpenGL as well. Change-Id: I5b58f21c3640a4403dc6aa710838d4904d85f482 Reviewed-by: Lubomir Rintel <lkundrak@v3.sk> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/qwayland-egl/qwaylandeglinclude.h4
-rw-r--r--src/plugins/platforms/qwayland-egl/qwaylandglcontext.cpp21
-rw-r--r--src/plugins/platforms/qwayland-egl/qwaylandglcontext.h4
3 files changed, 23 insertions, 6 deletions
diff --git a/src/plugins/platforms/qwayland-egl/qwaylandeglinclude.h b/src/plugins/platforms/qwayland-egl/qwaylandeglinclude.h
index fb42d43c1..9b151a5e8 100644
--- a/src/plugins/platforms/qwayland-egl/qwaylandeglinclude.h
+++ b/src/plugins/platforms/qwayland-egl/qwaylandeglinclude.h
@@ -47,10 +47,6 @@
#include <wayland-egl.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
#define EGL_EGLEXT_PROTOTYPES
#include <EGL/egl.h>
#include <EGL/eglext.h>
diff --git a/src/plugins/platforms/qwayland-egl/qwaylandglcontext.cpp b/src/plugins/platforms/qwayland-egl/qwaylandglcontext.cpp
index 303e59f76..278359bea 100644
--- a/src/plugins/platforms/qwayland-egl/qwaylandglcontext.cpp
+++ b/src/plugins/platforms/qwayland-egl/qwaylandglcontext.cpp
@@ -67,7 +67,23 @@ QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QSurfaceFormat
{
m_shareEGLContext = share ? static_cast<QWaylandGLContext *>(share)->eglContext() : EGL_NO_CONTEXT;
- eglBindAPI(EGL_OPENGL_ES_API);
+ switch (m_format.renderableType()) {
+ case QSurfaceFormat::OpenVG:
+ eglBindAPI(EGL_OPENVG_API);
+ break;
+#ifdef EGL_VERSION_1_4
+# if !defined(QT_OPENGL_ES_2)
+ case QSurfaceFormat::DefaultRenderableType:
+# endif
+ case QSurfaceFormat::OpenGL:
+ eglBindAPI(EGL_OPENGL_API);
+ break;
+#endif
+ case QSurfaceFormat::OpenGLES:
+ default:
+ eglBindAPI(EGL_OPENGL_ES_API);
+ break;
+ }
QVector<EGLint> eglContextAttrs;
eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION);
@@ -91,6 +107,9 @@ QWaylandGLContext::~QWaylandGLContext()
bool QWaylandGLContext::makeCurrent(QPlatformSurface *surface)
{
+ if (!isInitialized(QOpenGLFunctions::d_ptr))
+ initializeOpenGLFunctions();
+
QWaylandEglWindow *window = static_cast<QWaylandEglWindow *>(surface);
window->setCanResize(false);
diff --git a/src/plugins/platforms/qwayland-egl/qwaylandglcontext.h b/src/plugins/platforms/qwayland-egl/qwaylandglcontext.h
index bc231e82d..3e1eb3e73 100644
--- a/src/plugins/platforms/qwayland-egl/qwaylandglcontext.h
+++ b/src/plugins/platforms/qwayland-egl/qwaylandglcontext.h
@@ -45,6 +45,7 @@
#include "qwaylanddisplay.h"
#include <qpa/qplatformopenglcontext.h>
+#include <QtGui/QOpenGLFunctions>
#include "qwaylandeglinclude.h"
@@ -55,7 +56,8 @@ class QWaylandGLWindowSurface;
class QOpenGLShaderProgram;
class QOpenGLTextureCache;
-class QWaylandGLContext : public QPlatformOpenGLContext {
+class QWaylandGLContext : public QPlatformOpenGLContext, protected QOpenGLFunctions
+{
public:
QWaylandGLContext(EGLDisplay eglDisplay, const QSurfaceFormat &format, QPlatformOpenGLContext *share);
~QWaylandGLContext();