diff OrthancStone/Sources/OpenGL/OpenGLTextureArray.cpp @ 2066:cf3d85eb291c deep-learning

added class OpenGLTextureVolume
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 04 May 2023 17:18:14 +0200
parents 15f2e52835a1
children
line wrap: on
line diff
--- a/OrthancStone/Sources/OpenGL/OpenGLTextureArray.cpp	Thu May 04 16:59:28 2023 +0200
+++ b/OrthancStone/Sources/OpenGL/OpenGLTextureArray.cpp	Thu May 04 17:18:14 2023 +0200
@@ -187,14 +187,16 @@
       {
         throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageSize);
       }
-
-      if (layer >= depth_)
+      else if (layer >= depth_)
       {
         throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
       }
-
-      if (width_ != 0 &&
-          height_ != 0)
+      else if (image.GetPitch() != Orthanc::GetBytesPerPixel(format_) * width_)
+      {
+        throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, "Minimal pitch is required for upload");
+      }
+      else if (width_ != 0 &&
+               height_ != 0)
       {
         GLenum sourceFormat, internalFormat, pixelType;
         OpenGLTexture::ConvertToOpenGLFormats(sourceFormat, internalFormat, pixelType, image.GetFormat());