diff OrthancStone/Sources/OpenGL/OpenGLTexture.cpp @ 2061:6ea5f40ea0e9 deep-learning

added ImageProcessingProgram
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 03 May 2023 16:34:34 +0200
parents 86e0e92a2e0d
children fdb012c86a75
line wrap: on
line diff
--- a/OrthancStone/Sources/OpenGL/OpenGLTexture.cpp	Wed May 03 16:15:50 2023 +0200
+++ b/OrthancStone/Sources/OpenGL/OpenGLTexture.cpp	Wed May 03 16:34:34 2023 +0200
@@ -45,17 +45,20 @@
       format_(Orthanc::PixelFormat_Grayscale8),
       isLinearInterpolation_(false)
     {
-      if (!context_.IsContextLost())
+      if (context.IsContextLost())
       {
-        // Generate a texture object
-        glGenTextures(1, &texture_);
-        ORTHANC_OPENGL_CHECK("glGenTextures()");
+        throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError,
+                                        "OpenGL context has been lost");
+      }
 
-        if (texture_ == 0)
-        {
-          throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError,
-            "Cannot create an OpenGL texture");
-        }
+      // Generate a texture object
+      glGenTextures(1, &texture_);
+      ORTHANC_OPENGL_CHECK("glGenTextures()");
+
+      if (texture_ == 0)
+      {
+        throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError,
+                                        "Cannot create an OpenGL texture");
       }
     }