comparison Framework/Viewport/WebAssemblyViewport.cpp @ 1050:d393ad9cf68c

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 10 Oct 2019 14:31:56 +0200
parents 6a9300ecfa13
children 3c9529edf5fd
comparison
equal deleted inserted replaced
1049:348866dd217c 1050:d393ad9cf68c
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 **/ 19 **/
20 20
21 21
22 #include "WebAssemblyViewport.h" 22 #include "WebAssemblyViewport.h"
23
24 #include "../StoneException.h"
25
23 #include <emscripten/html5.h> 26 #include <emscripten/html5.h>
24 27
25 namespace OrthancStone 28 namespace OrthancStone
26 { 29 {
27 WebAssemblyOpenGLViewport::WebAssemblyOpenGLViewport(const std::string& canvas) : 30 WebAssemblyOpenGLViewport::WebAssemblyOpenGLViewport(const std::string& canvas) :
108 } 111 }
109 if (GetCompositor()) { 112 if (GetCompositor()) {
110 GetCompositor()->Refresh(); 113 GetCompositor()->Refresh();
111 } 114 }
112 } 115 }
113 catch (const OpenGLContextLostException& e) 116 catch (const StoneException& e)
114 { 117 {
115 LOG(WARNING) << "Context " << std::hex << e.context_ << " is lost! Compositor will be disabled."; 118 if (e.GetErrorCode() == ErrorCode_WebGLContextLost)
116 DisableCompositor(); 119 {
117 // we now need to wait for the "context restored" callback 120 LOG(WARNING) << "Context is lost! Compositor will be disabled.";
121 DisableCompositor();
122 // we now need to wait for the "context restored" callback
123 }
124 else
125 {
126 throw;
127 }
118 } 128 }
119 catch (...) 129 catch (...)
120 { 130 {
121 // something else nasty happened 131 // something else nasty happened
122 throw; 132 throw;