# HG changeset patch # User Sebastien Jodogne # Date 1678025158 -3600 # Node ID c9dadbe7c7b09f0b0b832118fbaf82729324d754 # Parent f3d756e5503f69f4d3ac14448ded59d6433a1189 notes diff -r f3d756e5503f -r c9dadbe7c7b0 OrthancStone/Sources/OpenGL/OpenGLTexture.cpp --- 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 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(); }