// Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include #include #include QT_BEGIN_NAMESPACE class QPlatformScreen; class QWasmOpenGLContext : public QPlatformOpenGLContext { public: QWasmOpenGLContext(const QSurfaceFormat &format); ~QWasmOpenGLContext(); QSurfaceFormat format() const override; void swapBuffers(QPlatformSurface *surface) override; GLuint defaultFramebufferObject(QPlatformSurface *surface) const override; bool makeCurrent(QPlatformSurface *surface) override; void doneCurrent() override; bool isSharing() const override; bool isValid() const override; QFunctionPointer getProcAddress(const char *procName) override; private: static bool isOpenGLVersionSupported(QSurfaceFormat format); bool maybeCreateEmscriptenContext(QPlatformSurface *surface); static EMSCRIPTEN_WEBGL_CONTEXT_HANDLE createEmscriptenContext(const QString &canvasId, QSurfaceFormat format); QSurfaceFormat m_requestedFormat; QPlatformScreen *m_screen = nullptr; EMSCRIPTEN_WEBGL_CONTEXT_HANDLE m_context = 0; }; QT_END_NAMESPACE