annotate Applications/Platforms/WebAssembly/WebAssemblyOpenGLContext.h @ 1739:9ac2a65d4172

upgrade to year 2021
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 06 Jan 2021 17:50:00 +0100
parents 4fb8fdf03314
children 3889ae96d2e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
616
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
1739
9ac2a65d4172 upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium
616
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
1596
4fb8fdf03314 removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1591
diff changeset
16 *
616
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #pragma once
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #if !defined(ORTHANC_ENABLE_WASM)
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 # error Macro ORTHANC_ENABLE_WASM must be defined
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #endif
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
891
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 617
diff changeset
28 #if ORTHANC_ENABLE_WASM != 1
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 617
diff changeset
29 # error This file can only be used if targeting WebAssembly
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 617
diff changeset
30 #endif
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 617
diff changeset
31
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 617
diff changeset
32 #if !defined(ORTHANC_ENABLE_OPENGL)
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 617
diff changeset
33 # error The macro ORTHANC_ENABLE_OPENGL must be defined
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 617
diff changeset
34 #endif
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 617
diff changeset
35
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 617
diff changeset
36 #if ORTHANC_ENABLE_OPENGL != 1
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 617
diff changeset
37 # error Support for OpenGL is disabled
0aff28f15ea2 new abstraction: IViewport
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 617
diff changeset
38 #endif
616
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
1591
5887a4f8594b moving platform-specific files out of the "OrthancStone" folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1576
diff changeset
40 #include "../../../OrthancStone/Sources/OpenGL/IOpenGLContext.h"
616
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41
1564
e731e62692a9 upgrading Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
42 #include <Compatibility.h> // For ORTHANC_OVERRIDE
947
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 891
diff changeset
43
616
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 #include <boost/shared_ptr.hpp>
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 namespace OrthancStone
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 {
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 namespace OpenGL
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 {
1051
7fad86d62135 removed unused abstraction IOpenGLContextLossMonitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1045
diff changeset
50 class WebAssemblyOpenGLContext : public OpenGL::IOpenGLContext
616
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 {
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 private:
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 class PImpl;
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 boost::shared_ptr<PImpl> pimpl_;
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 public:
1571
85e117739eca cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1564
diff changeset
57 explicit WebAssemblyOpenGLContext(const std::string& canvasSelector);
616
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58
956
a7351ad54960 Made IsContextLost automatically set the flag by checking with the emscripten
Benjamin Golinvaux <bgo@osimis.io>
parents: 947
diff changeset
59 virtual bool IsContextLost() ORTHANC_OVERRIDE;
a7351ad54960 Made IsContextLost automatically set the flag by checking with the emscripten
Benjamin Golinvaux <bgo@osimis.io>
parents: 947
diff changeset
60
947
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 891
diff changeset
61 virtual void MakeCurrent() ORTHANC_OVERRIDE;
616
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62
947
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 891
diff changeset
63 virtual void SwapBuffer() ORTHANC_OVERRIDE;
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 891
diff changeset
64
956
a7351ad54960 Made IsContextLost automatically set the flag by checking with the emscripten
Benjamin Golinvaux <bgo@osimis.io>
parents: 947
diff changeset
65 /**
a7351ad54960 Made IsContextLost automatically set the flag by checking with the emscripten
Benjamin Golinvaux <bgo@osimis.io>
parents: 947
diff changeset
66 Returns true if the underlying context has been successfully recreated
a7351ad54960 Made IsContextLost automatically set the flag by checking with the emscripten
Benjamin Golinvaux <bgo@osimis.io>
parents: 947
diff changeset
67 */
a7351ad54960 Made IsContextLost automatically set the flag by checking with the emscripten
Benjamin Golinvaux <bgo@osimis.io>
parents: 947
diff changeset
68 //bool TryRecreate();
a7351ad54960 Made IsContextLost automatically set the flag by checking with the emscripten
Benjamin Golinvaux <bgo@osimis.io>
parents: 947
diff changeset
69
1351
1b8e37770d78 ID vs CSS selector distinction in API and field names.
Benjamin Golinvaux <bgo@osimis.io>
parents: 1270
diff changeset
70 const std::string& GetCanvasSelector() const;
1051
7fad86d62135 removed unused abstraction IOpenGLContextLossMonitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1045
diff changeset
71
7fad86d62135 removed unused abstraction IOpenGLContextLossMonitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1045
diff changeset
72
7fad86d62135 removed unused abstraction IOpenGLContextLossMonitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1045
diff changeset
73 /**
7fad86d62135 removed unused abstraction IOpenGLContextLossMonitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1045
diff changeset
74 * This is for manual context loss (debug purposes)
7fad86d62135 removed unused abstraction IOpenGLContextLossMonitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1045
diff changeset
75 **/
7fad86d62135 removed unused abstraction IOpenGLContextLossMonitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1045
diff changeset
76 void* DebugGetInternalContext() const;
7fad86d62135 removed unused abstraction IOpenGLContextLossMonitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1045
diff changeset
77 void SetLostContext();
616
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 };
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 }
97926984d5d0 WebAssembly sample using Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 }