changeset 2056:66c130af0d3c deep-learning

OpenGLTexture::SetClampingToZero() is not available in wasm
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 18 Apr 2023 15:18:36 +0200
parents d4e769a0961f
children 8bb8d9c0cfd0
files OrthancStone/Sources/OpenGL/OpenGLTexture.cpp
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancStone/Sources/OpenGL/OpenGLTexture.cpp	Tue Apr 18 10:53:09 2023 +0200
+++ b/OrthancStone/Sources/OpenGL/OpenGLTexture.cpp	Tue Apr 18 15:18:36 2023 +0200
@@ -273,12 +273,25 @@
 
     void OpenGLTexture::SetClampingToZero()
     {
+      ORTHANC_OPENGL_CHECK("Entering OpenGLTexture::SetClampingToZero()");
+      
+#if defined(__EMSCRIPTEN__)
+      /**
+       * This is because WebGL 2 derives from OpenGL ES 3.0, which
+       * doesn't support GL_CLAMP_TO_BORDER, as can be seen here:
+       * https://registry.khronos.org/OpenGL-Refpages/es3.0/html/glTexParameter.xhtml
+       **/
+      LOG(WARNING) << "OpenGLTexture::SetClampingToZero() is not available in WebGL 2";
+#else
       glBindTexture(GL_TEXTURE_2D, texture_);
       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
 
       GLfloat colorfv[4] = { 0, 0, 0, 0 };
       glTextureParameterfv(texture_, GL_TEXTURE_BORDER_COLOR, colorfv);
+#endif
+      
+      ORTHANC_OPENGL_CHECK("Exiting OpenGLTexture::SetClampingToZero()");
     }