changeset 2040:c6263f514f54 deep-learning

allow warnings while creating shaders
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 01 Feb 2023 08:04:51 +0100
parents e0906b7c67b9
children 85a20cbfcc04
files OrthancStone/Sources/OpenGL/OpenGLShader.cpp
diffstat 1 files changed, 18 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancStone/Sources/OpenGL/OpenGLShader.cpp	Sat Jan 28 15:48:01 2023 +0100
+++ b/OrthancStone/Sources/OpenGL/OpenGLShader.cpp	Wed Feb 01 08:04:51 2023 +0100
@@ -55,6 +55,8 @@
         glCompileShader(shader);
         ORTHANC_OPENGL_CHECK("glCompileShader");
 
+        GLenum error = glGetError();
+
         // Check if there were errors
         int infoLen = 0;
         glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
@@ -65,18 +67,24 @@
           std::string infoLog;
           infoLog.resize(infoLen + 1);
           glGetShaderInfoLog(shader, infoLen, NULL, &infoLog[0]);
-          ORTHANC_OPENGL_CHECK("glGetShaderInfoLog");
-          ORTHANC_OPENGL_TRACE_CURRENT_CONTEXT("About to call glDeleteShader");
-          glDeleteShader(shader);
-          ORTHANC_OPENGL_CHECK("glDeleteShader");
 
-          throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError,
-                                          "Error while creating an OpenGL shader: " + infoLog);
+          if (error)
+          {
+            ORTHANC_OPENGL_CHECK("glGetShaderInfoLog");
+            ORTHANC_OPENGL_TRACE_CURRENT_CONTEXT("About to call glDeleteShader");
+            glDeleteShader(shader);
+            ORTHANC_OPENGL_CHECK("glDeleteShader");
+            
+            throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError,
+                                            "Error while creating an OpenGL shader: " + infoLog);
+          }
+          else
+          {
+            LOG(WARNING) << "Warning while creating an OpenGL shader: " << infoLog;
+          }
         }
-        else
-        {
-          return shader;
-        }
+
+        return shader;
       }
     }