1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-16 10:08:36 +03:00

0026404: Visualization, Ray Tracing - use solid background color when gradient color is disabled

Test-case for issue #26404
This commit is contained in:
kgv 2015-07-09 14:25:31 +03:00 committed by bugmaster
parent b285c9fed2
commit 67c12d8020
2 changed files with 40 additions and 1 deletions

View File

@ -2263,13 +2263,25 @@ Standard_Boolean OpenGl_View::setUniformState (const Graphic3d_CView& the
}
// Set background colors (only gradient background supported)
if (myBgGradientArray != NULL)
if (myBgGradientArray != NULL
&& myBgGradientArray->IsDefined())
{
theProgram->SetUniform (theGlContext,
myUniformLocations[theProgramId][OpenGl_RT_uBackColorTop], myBgGradientArray->GradientColor (0));
theProgram->SetUniform (theGlContext,
myUniformLocations[theProgramId][OpenGl_RT_uBackColorBot], myBgGradientArray->GradientColor (1));
}
else
{
const OpenGl_Vec4 aBackColor (theCView.DefWindow.Background.r,
theCView.DefWindow.Background.g,
theCView.DefWindow.Background.b,
1.0f);
theProgram->SetUniform (theGlContext,
myUniformLocations[theProgramId][OpenGl_RT_uBackColorTop], aBackColor);
theProgram->SetUniform (theGlContext,
myUniformLocations[theProgramId][OpenGl_RT_uBackColorBot], aBackColor);
}
theProgram->SetUniform (theGlContext,
myUniformLocations[theProgramId][OpenGl_RT_uSphereMapForBack], theCView.RenderParams.UseEnvironmentMapBackground ? 1 : 0);

27
tests/bugs/vis/bug26404 Normal file
View File

@ -0,0 +1,27 @@
puts "========"
puts "OCC26404"
puts "========"
puts ""
###########################################################################################
# Visualization, Ray Tracing - use solid background color when gradient color is disabled
###########################################################################################
box b 1 2 3
vinit View1
vclear
vaxo
vsetdispmode 1
vsetcolorbg 10 10 10
vdisplay b
vfit
vraytrace 1
set bug_info_1 [vreadpixel 50 50 rgb name]
if {$bug_info_1 != "GRAY8"} {
puts "ERROR: OCC26404 is reproduced. Background color is invalid (case #1)."
}
vsetgradientbg 255 0 0 0 0 255 1
vsetgradientbg 255 0 0 0 0 255 0
set bug_info_2 [vreadpixel 50 50 rgb name]
if {$bug_info_2 != "GRAY8"} {
puts "ERROR: OCC26404 is reproduced. Background color is invalid (case #2)."
}