diff options
6 files changed, 25 insertions, 11 deletions
diff --git a/config.tests/egl/egl.pro b/config.tests/egl/egl.pro index e96672e58..9886579ba 100644 --- a/config.tests/egl/egl.pro +++ b/config.tests/egl/egl.pro @@ -1,7 +1,7 @@ TARGET = egl QT = core -!contains(QT_CONFIG, opengles2):error("wayland_egl support currently requires Qt configured with OpenGL ES2") +!contains(QT_CONFIG, opengl): error("wayland_egl support requires Qt configured with OpenGL") !contains(QT_CONFIG, no-pkg-config) { CONFIG += link_pkgconfig diff --git a/config.tests/wayland_egl/wayland_egl.pro b/config.tests/wayland_egl/wayland_egl.pro index 0db9b04f1..3b7fdfe52 100644 --- a/config.tests/wayland_egl/wayland_egl.pro +++ b/config.tests/wayland_egl/wayland_egl.pro @@ -1,7 +1,7 @@ TARGET = wayland_egl QT = core -!contains(QT_CONFIG, opengles2):error("wayland_egl support currently requires Qt configured with OpenGL ES2") +!contains(QT_CONFIG, opengl): error("wayland_egl support requires Qt configured with OpenGL") !contains(QT_CONFIG, no-pkg-config) { CONFIG += link_pkgconfig 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(); diff --git a/src/plugins/waylandcompositors/wayland-egl/waylandeglintegration.cpp b/src/plugins/waylandcompositors/wayland-egl/waylandeglintegration.cpp index e2f0efbfc..e01de7984 100644 --- a/src/plugins/waylandcompositors/wayland-egl/waylandeglintegration.cpp +++ b/src/plugins/waylandcompositors/wayland-egl/waylandeglintegration.cpp @@ -54,9 +54,6 @@ #include <EGL/egl.h> #include <EGL/eglext.h> -#include <GLES2/gl2.h> -#include <GLES2/gl2ext.h> - #ifndef EGL_WL_bind_wayland_display typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDWAYLANDDISPLAYWL) (EGLDisplay dpy, struct wl_display *display); typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNBINDWAYLANDDISPLAYWL) (EGLDisplay dpy, struct wl_display *display); |