Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwasmopenglcontext.h
Go to the documentation of this file.
1// Copyright (C) 2018 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QWASMOPENGLCONTEXT_H
5#define QWASMOPENGLCONTEXT_H
6
7#include <qpa/qplatformopenglcontext.h>
8
9#include <emscripten.h>
10#include <emscripten/html5.h>
11
13
14class QOpenGLContext;
15class QPlatformScreen;
18{
19public:
22
23 QSurfaceFormat format() const override;
24 void swapBuffers(QPlatformSurface *surface) override;
25 GLuint defaultFramebufferObject(QPlatformSurface *surface) const override;
26 bool makeCurrent(QPlatformSurface *surface) override;
27 void doneCurrent() override;
28 bool isSharing() const override;
29 bool isValid() const override;
30 QFunctionPointer getProcAddress(const char *procName) override;
31
32private:
33 struct QOpenGLContextData
34 {
35 QPlatformSurface *surface = nullptr;
36 EMSCRIPTEN_WEBGL_CONTEXT_HANDLE handle = 0;
37 };
38
39 static bool isOpenGLVersionSupported(QSurfaceFormat format);
40 EMSCRIPTEN_WEBGL_CONTEXT_HANDLE obtainEmscriptenContext(QPlatformSurface *surface);
41 static EMSCRIPTEN_WEBGL_CONTEXT_HANDLE
42 createEmscriptenContext(const std::string &canvasSelector, QSurfaceFormat format);
43
44 static void destroyWebGLContext(EMSCRIPTEN_WEBGL_CONTEXT_HANDLE contextHandle);
45
46 QSurfaceFormat m_actualFormat;
47 QOpenGLContext *m_qGlContext;
48 QOpenGLContextData m_ownedWebGLContext;
49 EMSCRIPTEN_WEBGL_CONTEXT_HANDLE m_usedWebGLContextHandle = 0;
50};
51
53
54#endif // QWASMOPENGLCONTEXT_H
\inmodule QtGui
The QPlatformOpenGLContext class provides an abstraction for native GL contexts.
QOpenGLContext * context() const
The QPlatformScreen class provides an abstraction for visual displays.
The QPlatformSurface class provides an abstraction for a surface.
The QSurfaceFormat class represents the format of a QSurface. \inmodule QtGui.
bool isSharing() const override
bool isValid() const override
void doneCurrent() override
void swapBuffers(QPlatformSurface *surface) override
Reimplement in subclass to native swap buffers calls.
bool makeCurrent(QPlatformSurface *surface) override
QSurfaceFormat format() const override
QWasmOpenGLContext(QOpenGLContext *context)
GLuint defaultFramebufferObject(QPlatformSurface *surface) const override
Reimplement in subclass if your platform uses framebuffer objects for surfaces.
Combined button and popup list for selecting options.
GLuint64 GLenum void * handle
GLint GLsizei GLsizei GLenum format
const void * getProcAddress
#define GLuint