comparison Framework/OpenGL/WebAssemblyOpenGLContext.cpp @ 942:685c9a2d115f

Added missing ORTHANC_OVERRIDE + preparation for lost GL context handling + stubs for GL context event handlers
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 05 Aug 2019 12:27:27 +0200
parents f557b18d287f
children 2db3ef713664
comparison
equal deleted inserted replaced
939:ab90628e70d9 942:685c9a2d115f
22 #include "WebAssemblyOpenGLContext.h" 22 #include "WebAssemblyOpenGLContext.h"
23 23
24 #include <Core/OrthancException.h> 24 #include <Core/OrthancException.h>
25 25
26 #include <emscripten/html5.h> 26 #include <emscripten/html5.h>
27 #include <emscripten/em_asm.h>
28
27 #include <boost/math/special_functions/round.hpp> 29 #include <boost/math/special_functions/round.hpp>
28 30
29 namespace OrthancStone 31 namespace OrthancStone
30 { 32 {
31 namespace OpenGL 33 namespace OpenGL
68 return canvas_; 70 return canvas_;
69 } 71 }
70 72
71 void MakeCurrent() 73 void MakeCurrent()
72 { 74 {
75 if (emscripten_is_webgl_context_lost(context_))
76 {
77 LOG(ERROR) << "OpenGL context has been lost! for canvas: " << canvas_;
78 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError,
79 "OpenGL context has been lost!");
80 }
81
73 if (emscripten_webgl_make_context_current(context_) != EMSCRIPTEN_RESULT_SUCCESS) 82 if (emscripten_webgl_make_context_current(context_) != EMSCRIPTEN_RESULT_SUCCESS)
74 { 83 {
75 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, 84 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError,
76 "Cannot set the OpenGL context"); 85 "Cannot set the OpenGL context");
77 } 86 }