]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
IPAL54437: TC9.2.0: GUI: Horizontal and vertical gradients in VTK 3D view are inverted
authorvsr <vsr@opencascade.com>
Thu, 27 Sep 2018 12:49:42 +0000 (15:49 +0300)
committervsr <vsr@opencascade.com>
Thu, 27 Sep 2018 12:49:42 +0000 (15:49 +0300)
src/VTKViewer/VTKViewer_OpenGLRenderer.cxx

index f99d102e143dcf0fe23b4c0cd4600d13f43d9886..60e9b0fd1c8cada5ea45a9429e00d95a6d19de6b 100644 (file)
@@ -153,17 +153,26 @@ void VTKViewer_OpenGLRenderer::Clear(void)
       {
         case HorizontalGradient:
           corner1 = this->Background;
-          corner2 = this->Background2;
+          corner2 = this->Background;
           corner3 = this->Background2;
-          corner4 = this->Background;
+          corner4 = this->Background2;
           break;
         case VerticalGradient:
-          corner1 = this->Background2;
+          corner1 = this->Background;
           corner2 = this->Background2;
-          corner3 = this->Background;
+          corner3 = this->Background2;
           corner4 = this->Background;
           break;
         case FirstDiagonalGradient:
+          corner1 = this->Background;
+          corner3 = this->Background2;
+          dcorner1[0] = dcorner2[0] = 0.5F * ( corner1[0] + corner3[0] );
+          dcorner1[1] = dcorner2[1] = 0.5F * ( corner1[1] + corner3[1] );
+          dcorner1[2] = dcorner2[2] = 0.5F * ( corner1[2] + corner3[2] );
+          corner2 = dcorner1;
+          corner4 = dcorner2;
+          break;
+        case SecondDiagonalGradient:
           corner2 = this->Background2;
           corner4 = this->Background;
           dcorner1[0] = dcorner2[0] = 0.5F * ( corner2[0] + corner4[0] );
@@ -172,36 +181,27 @@ void VTKViewer_OpenGLRenderer::Clear(void)
           corner1 = dcorner1;
           corner3 = dcorner2;
           break;
-        case SecondDiagonalGradient:
-          corner1 = this->Background2;  
-          corner3 = this->Background;
-          dcorner1[0] = dcorner2[0] = 0.5F * ( corner1[0] + corner3[0] );
-          dcorner1[1] = dcorner2[1] = 0.5F * ( corner1[1] + corner3[1] );
-          dcorner1[2] = dcorner2[2] = 0.5F * ( corner1[2] + corner3[2] );
-          corner2 = dcorner1;
-          corner4 = dcorner2;
-          break;
         case FirstCornerGradient:
           corner1 = this->Background2;
           corner2 = this->Background2;
-          corner3 = this->Background2;
-          corner4 = this->Background;
+          corner3 = this->Background;
+          corner4 = this->Background2;
           break;
         case SecondCornerGradient:
           corner1 = this->Background2;
           corner2 = this->Background2;
-          corner3 = this->Background;
-          corner4 = this->Background2;
+          corner3 = this->Background2;
+          corner4 = this->Background;
           break;
         case ThirdCornerGradient:
-          corner1 = this->Background2;
-          corner2 = this->Background;
+          corner1 = this->Background;
+          corner2 = this->Background2;
           corner3 = this->Background2;
           corner4 = this->Background2;
           break;
         case FourthCornerGradient:
-          corner1 = this->Background;
-          corner2 = this->Background2;
+          corner1 = this->Background2;
+          corner2 = this->Background;
           corner3 = this->Background2;
           corner4 = this->Background2;
           break;
@@ -320,7 +320,7 @@ void VTKViewer_OpenGLRenderer::Clear(void)
         if( aPosition == VTKViewer_Texture::Tiled )
         {
           texX = (GLfloat)aViewWidth / (GLfloat)aWidth;
-          texY = (GLfloat)aViewHeight / (GLfloat)aHeight;
+          texY = (GLfloat)aViewHeight / (GLfloat)aHeight; texY *= -1;
         }
 #ifdef VTK_OPENGL2
         if (this->OpenGLHelper.IsInitialized())
@@ -334,7 +334,7 @@ void VTKViewer_OpenGLRenderer::Clear(void)
           this->OpenGLHelper.vglBindVertexArrayARB  (this->VertexArrayObject);
 
           GLfloat dx = (aPosition == VTKViewer_Texture::Centered) ? (( (GLfloat)aWidth / (GLfloat)aViewWidth )) : 1.0f;
-          GLfloat dy = (aPosition == VTKViewer_Texture::Centered) ? (( (GLfloat)aHeight / (GLfloat)aViewHeight )) : 1.0f;
+          GLfloat dy = (aPosition == VTKViewer_Texture::Centered) ? (( (GLfloat)aHeight / (GLfloat)aViewHeight )) : (aPosition == VTKViewer_Texture::Stretched) ? 1.0f : -1.0f;
 
 
           // First 4 components of Vertex is TexCoords now.