1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

0029051: Visualization, TKOpenGl - wrong color of transparent dynamic highlight with OIT tuned ON

OpenGl_PrimitiveArray::Render() - removed obsolete code, which become redundant (and broken)
after moving rendering of transparent objects into OpenGl_LayerList::renderTransparent().
This commit is contained in:
kgv 2017-08-25 15:49:40 +03:00 committed by bugmaster
parent 3dffe5f265
commit e21fec8100
3 changed files with 55 additions and 29 deletions

View File

@ -840,36 +840,7 @@ void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace
const Graphic3d_Vec4* aFaceColors = !myBounds.IsNull() && !toHilight && anAspectFace->Aspect()->InteriorStyle() != Aspect_IS_HIDDENLINE
? myBounds->Colors
: NULL;
const Standard_Boolean isHighlightWithTransparency = toHilight &&
myDrawMode > GL_LINE_STRIP &&
theWorkspace->InteriorColor().a() > 0.05f;
GLint aPrevBlendSrc = GL_SRC_ALPHA, aPrevBlendDst = GL_ONE_MINUS_SRC_ALPHA;
GLboolean wasBlendEnabled = GL_FALSE;
if (isHighlightWithTransparency)
{
wasBlendEnabled = glIsEnabled (GL_BLEND);
#if !defined(GL_ES_VERSION_2_0)
glGetIntegerv (GL_BLEND_SRC, &aPrevBlendSrc);
glGetIntegerv (GL_BLEND_DST, &aPrevBlendDst);
#endif
if (!wasBlendEnabled)
{
glEnable (GL_BLEND);
}
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
drawArray (theWorkspace, aFaceColors, hasColorAttrib);
if (isHighlightWithTransparency)
{
glBlendFunc (aPrevBlendSrc, aPrevBlendDst);
if (!wasBlendEnabled)
{
glDisable (GL_BLEND);
}
}
}
if (myDrawMode <= GL_LINE_STRIP)

34
tests/bugs/vis/bug28527 Normal file
View File

@ -0,0 +1,34 @@
puts "============"
puts "0028527: Visualization, AIS_InteractiveContext - custom selection presentation is never removed from View"
puts "============"
puts ""
pload MODELING XDE VISUALIZATION
vclear
vclose ALL
vinit View1
box b -100 0 0 10 20 30
meshfromstl m [locate_data_file OMF6391_box.stl]
vfit
vsetdispmode m 2
vselmode m 8 1
vselect 0 0 409 409 0 409
verase m
vdisplay -dispMode 1 -highMode 1 b
vfit
if { [vreadpixel 165 400 rgb name] != "DARKGOLDENROD3" } { puts "Error: fit all produces incorrect result after Erase" }
vdump $::imagedir/${::casename}_1.png
verase b
vdisplay m
vfit
vselmode m 8 1
vselect 0 0 409 409 0 409
vremove m
vdisplay -dispMode 1 -highMode 1 b
vfit
if { [vreadpixel 165 400 rgb name] != "DARKGOLDENROD3" } { puts "Error: fit all produces incorrect result after Remove" }
vdump $::imagedir/${::casename}_2.png

21
tests/bugs/vis/bug29051 Normal file
View File

@ -0,0 +1,21 @@
puts "========"
puts "0029051: Visualization, TKOpenGl - wrong color of transparent dynamic highlight with OIT tuned ON"
puts "========"
puts ""
pload MODELING VISUALIZATION
box b 1 2 3
vclear
vinit View1
vdisplay -dispMode 1 b
vfit
vselprops dynHighlight -dispMode 1 -color RED -transp 0.2
vmoveto 250 250
vrenderparams -oit off
if { [vreadpixel 250 250 rgb name] != "ORANGERED3" } { puts "Error: wrong highlight color with OIT turned OFF"}
vdump $imagedir/${casename}_oit_off.png
vrenderparams -oit 0
vreadpixel 250 250 rgb name
if { [vreadpixel 250 250 rgb name] != "ORANGERED3" } { puts "Error: wrong highlight color with OIT turned ON"}
vdump $imagedir/${casename}_oit_on.png