changeset 2041:85a20cbfcc04 deep-learning

check glUseProgram()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 01 Feb 2023 08:23:26 +0100
parents c6263f514f54
children 0fa4c0ca429d
files OrthancStone/Sources/OpenGL/OpenGLProgram.cpp OrthancStone/Sources/OpenGL/OpenGLShader.cpp
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancStone/Sources/OpenGL/OpenGLProgram.cpp	Wed Feb 01 08:04:51 2023 +0100
+++ b/OrthancStone/Sources/OpenGL/OpenGLProgram.cpp	Wed Feb 01 08:23:26 2023 +0100
@@ -86,6 +86,12 @@
     {
       //ORTHANC_OPENGL_TRACE_CURRENT_CONTEXT("About to call glUseProgram");
       glUseProgram(program_);
+      if (glGetError() != GL_NO_ERROR)
+      {
+        throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError,
+                                        "Cannot use successfully compiled OpenGL shader");
+      }
+      
       ORTHANC_OPENGL_CHECK("glUseProgram");
     }
         
--- a/OrthancStone/Sources/OpenGL/OpenGLShader.cpp	Wed Feb 01 08:04:51 2023 +0100
+++ b/OrthancStone/Sources/OpenGL/OpenGLShader.cpp	Wed Feb 01 08:23:26 2023 +0100
@@ -58,7 +58,7 @@
         GLenum error = glGetError();
 
         // Check if there were errors
-        int infoLen = 0;
+        GLint infoLen = 0;
         glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
         ORTHANC_OPENGL_CHECK("glGetShaderiv");