diff options
author | Svenn-Arne Dragly <s@dragly.com> | 2016-02-25 15:36:22 +0100 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2016-05-02 21:35:56 +0000 |
commit | f4f5219f0017d36e1b14fc4b88e9006b59c75b3f (patch) | |
tree | 2857566989115502c2be5846b6adfffb76825ee7 /src/plugins/platforms/pepper/qpepperglcontext.cpp | |
parent | 375adf412f44466a9ef588529ebbf7f102878919 (diff) |
Update support for Emscripten
Change-Id: I5d696f0dbc188acb4faad83240f7b1aa7177dc48
Reviewed-by: Svenn-Arne Dragly <s@dragly.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/plugins/platforms/pepper/qpepperglcontext.cpp')
-rw-r--r-- | src/plugins/platforms/pepper/qpepperglcontext.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/plugins/platforms/pepper/qpepperglcontext.cpp b/src/plugins/platforms/pepper/qpepperglcontext.cpp index 7587062c05..da7cc315fd 100644 --- a/src/plugins/platforms/pepper/qpepperglcontext.cpp +++ b/src/plugins/platforms/pepper/qpepperglcontext.cpp @@ -44,7 +44,12 @@ #include <ppapi/cpp/graphics_3d.h> #include <ppapi/cpp/graphics_3d_client.h> + +// Emscriptens GLES2 API is more complete than pepper.js +#ifndef Q_OS_NACL_EMSCRIPTEN #include <ppapi/gles2/gl2ext_ppapi.h> +#endif + #include <QtCore/QCoreApplication> #include <QtCore/QThread> @@ -109,15 +114,18 @@ bool QPepperGLContext::makeCurrent(QPlatformSurface *surface) } m_currentSize = newSize; } - +#ifndef Q_OS_NACL_EMSCRIPTEN glSetCurrentContextPPAPI(m_context.pp_resource()); +#endif return true; } void QPepperGLContext::doneCurrent() { qCDebug(QT_PLATFORM_PEPPER_GLCONTEXT) << "doneCurrent"; +#ifndef Q_OS_NACL_EMSCRIPTEN glSetCurrentContextPPAPI(0); +#endif } QFunctionPointer QPepperGLContext::getProcAddress(const QByteArray &procName) @@ -144,10 +152,12 @@ void QPepperGLContext::flushCallback(int32_t) bool QPepperGLContext::initGl() { qCDebug(QT_PLATFORM_PEPPER_GLCONTEXT) << "initGl"; +#ifndef Q_OS_NACL_EMSCRIPTEN if (!glInitializePPAPI(pp::Module::Get()->get_browser_interface())) { qWarning("Unable to initialize GL PPAPI!\n"); return false; } +#endif m_currentSize = QPepperInstancePrivate::get()->geometry().size(); QSurfaceFormat f = format(); @@ -165,7 +175,9 @@ bool QPepperGLContext::initGl() if (!instance->BindGraphics(m_context)) { qWarning("Unable to bind 3d context!\n"); m_context = pp::Graphics3D(); +#ifndef Q_OS_NACL_EMSCRIPTEN glSetCurrentContextPPAPI(0); +#endif return false; } |