0026599: Visualization, TKOpenGl - gradient background should reset model transformat...
authorkgv <kgv@opencascade.com>
Thu, 27 Aug 2015 10:49:39 +0000 (13:49 +0300)
committerski <ski@opencascade.com>
Thu, 27 Aug 2015 12:30:14 +0000 (15:30 +0300)
OpenGl_View::DrawBackground() - reset ModelWorldState as wellm not just WorldViewState.
Test case for issue CR26599

src/OpenGl/OpenGl_View_2.cxx
tests/bugs/vis/bug26599 [new file with mode: 0755]

index 0fedacb..73f874c 100644 (file)
@@ -173,12 +173,14 @@ void OpenGl_View::DrawBackground (const Handle(OpenGl_Workspace)& theWorkspace)
     aCtx->core11fwd->glDisable (GL_DEPTH_TEST);
   }
 
-  aCtx->WorldViewState.Push();
   aCtx->ProjectionState.Push();
-  aCtx->WorldViewState.SetIdentity();
+  aCtx->WorldViewState.Push();
+  aCtx->ModelWorldState.Push();
   aCtx->ProjectionState.SetIdentity();
+  aCtx->WorldViewState.SetIdentity();
+  aCtx->ModelWorldState.SetIdentity();
   aCtx->ApplyProjectionMatrix();
-  aCtx->ApplyWorldViewMatrix();
+  aCtx->ApplyModelViewMatrix();
 
   // Drawing background gradient if:
   // - gradient fill type is not Aspect_GFM_NONE and
@@ -234,10 +236,11 @@ void OpenGl_View::DrawBackground (const Handle(OpenGl_Workspace)& theWorkspace)
     theWorkspace->SetAspectFace (anOldAspectFace);
   }
 
+  aCtx->ModelWorldState.Pop();
   aCtx->WorldViewState.Pop();
   aCtx->ProjectionState.Pop();
   aCtx->ApplyProjectionMatrix();
-  aCtx->ApplyWorldViewMatrix();
+  aCtx->ApplyModelViewMatrix();
 
   if (wasUsedZBuffer)
   {
diff --git a/tests/bugs/vis/bug26599 b/tests/bugs/vis/bug26599
new file mode 100755 (executable)
index 0000000..36ea93d
--- /dev/null
@@ -0,0 +1,27 @@
+puts "============"
+puts "CR26599"
+puts "============"
+puts ""
+
+##########################################################################################
+# Visualization, TKOpenGl - gradient background should reset model transformation in Core profile
+##########################################################################################
+
+vcaps -ffp 0
+
+vinit View1
+vclear
+vaxo
+
+vsetgradientbg 255 0 0 0 0 255 2
+box b 1 2 3
+vdisplay b
+
+vfit
+
+vlocrotate b 0 0 0 0 0 1 50
+
+vmoveto 380 50
+checkcolor 380 50 0.87450981140136719 0 0.12156862765550613
+
+vdump ${imagedir}/${casename}.png