changeset 2044:c9dadbe7c7b0 deep-learning

notes
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 05 Mar 2023 15:05:58 +0100
parents f3d756e5503f
children e5c812a36746
files OrthancStone/Sources/OpenGL/OpenGLTexture.cpp
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancStone/Sources/OpenGL/OpenGLTexture.cpp	Fri Feb 10 09:13:49 2023 +0100
+++ b/OrthancStone/Sources/OpenGL/OpenGLTexture.cpp	Sun Mar 05 15:05:58 2023 +0100
@@ -114,7 +114,7 @@
                      0, sourceFormat, pixelType, data);
 
 #if !defined(__EMSCRIPTEN__)
-        // "glGetTexLevelParameteriv()" seems to be undefined on WebGL
+        // glGetTexLevelParameteriv() is not implemented yet in Emscripten 3.1.7
         GLint w, h;
         glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w);
         glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &h);
@@ -187,6 +187,15 @@
       std::unique_ptr<Orthanc::ImageAccessor> target(new Orthanc::Image(format, width_, height_, true));
       assert(target->GetPitch() == width_ * Orthanc::GetBytesPerPixel(format));
 
+#if defined(__EMSCRIPTEN__)
+      /**
+       * The "glGetTexImage()" is unavailable in WebGL, it is
+       * necessary to use a framebuffer:
+       * https://stackoverflow.com/a/15064957
+       **/
+      throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
+
+#else
       glBindTexture(GL_TEXTURE_2D, texture_);
 
       switch (format)
@@ -210,6 +219,7 @@
         default:
           throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
       }
+#endif
 
       return target.release();
     }