From 0b0f8e6acb93bf6262e8bc3e1d35db90568913f1 Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 27 Sep 2018 15:49:42 +0300 Subject: [PATCH] IPAL54437: TC9.2.0: GUI: Horizontal and vertical gradients in VTK 3D view are inverted --- src/VTKViewer/VTKViewer_OpenGLRenderer.cxx | 46 +++++++++++----------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/VTKViewer/VTKViewer_OpenGLRenderer.cxx b/src/VTKViewer/VTKViewer_OpenGLRenderer.cxx index f99d102e1..60e9b0fd1 100644 --- a/src/VTKViewer/VTKViewer_OpenGLRenderer.cxx +++ b/src/VTKViewer/VTKViewer_OpenGLRenderer.cxx @@ -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. -- 2.39.2