diff 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
line wrap: on
line diff
--- a/Framework/OpenGL/WebAssemblyOpenGLContext.cpp	Wed Jul 31 11:29:08 2019 +0200
+++ b/Framework/OpenGL/WebAssemblyOpenGLContext.cpp	Mon Aug 05 12:27:27 2019 +0200
@@ -24,6 +24,8 @@
 #include <Core/OrthancException.h>
 
 #include <emscripten/html5.h>
+#include <emscripten/em_asm.h>
+
 #include <boost/math/special_functions/round.hpp>
 
 namespace OrthancStone
@@ -70,6 +72,13 @@
 
       void MakeCurrent()
       {
+        if (emscripten_is_webgl_context_lost(context_))
+        {
+          LOG(ERROR) << "OpenGL context has been lost! for canvas: " << canvas_;
+          throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError,
+            "OpenGL context has been lost!");
+        }
+
         if (emscripten_webgl_make_context_current(context_) != EMSCRIPTEN_RESULT_SUCCESS)
         {
           throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError,