For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Bug in AIS_TexturedShape::Compute()?

EricThompson's picture
Forums: 

While porting my application from 6.2.0 to 6.5.3, I believe I found a bug in the new version of AIS_TexturedShape::Compute().

I have my own class derived from AIS_TexturedShape. When I moved to 6.5.3, I found that while my shapes drew correctly in wireframe, they did not appear in shaded mode. While stepping through the source code, I noticed that the logic changed in the Compute() method's shaded case.

In the old version, if OwnDeviationAngle and OwnDeviationCoefficient both return false, it would skip calling BRepTools::Clean() then go on to draw the shaded surface.

In the new version, if OwnDeviationAngle and OwnDeviationCoefficient both return false, it breaks out of the shaded case and does not draw anything for the surface.

Note that the 6.5.3 version of AIS_Shape::Compute() does not have this problem, only the textured shape does.

Here is the source code for she shape case from 6.2.0 and 6.5.3:

6.2.0

case 1: // Shading)
{
Standard_Real prevangle ;
Standard_Real newangle ;
Standard_Real prevcoeff ;
Standard_Real newcoeff ;

if (OwnDeviationAngle(newangle,prevangle) || OwnDeviationCoefficient(newcoeff,prevcoeff))

if (Abs (newangle - prevangle) > Precision::Angular() || Abs (newcoeff - prevcoeff) > Precision::Confusion() )
{
BRepTools::Clean(myshape);
}

if ((Standard_Integer) myshape.ShapeType()>4)
StdPrs_WFDeflectionShape::Add(aPrs,myshape,myDrawer);
else
{
myDrawer->SetShadingAspectGlobal(Standard_False);
if (IsInfinite())
StdPrs_WFDeflectionShape::Add(aPrs,myshape,myDrawer);
else
{
try
{
OCC_CATCH_SIGNALS
StdPrs_ShadedShape::Add(aPrs,myshape,myDrawer);
}
catch (Standard_Failure)
{
cout StdPrs_WFShape::Add(aPrs,myshape,myDrawer);
}
}
}
break;
}

6.3.5

case 1: // Shading
{
Standard_Real prevangle;
Standard_Real newangle;
Standard_Real prevcoeff;
Standard_Real newcoeff;

if (!OwnDeviationAngle (newangle, prevangle) && !OwnDeviationCoefficient (newcoeff, prevcoeff))
{
break;
}

if (Abs (newangle - prevangle) > Precision::Angular() || Abs (newcoeff - prevcoeff) > Precision::Confusion())
{
BRepTools::Clean (myshape);
}

if (myshape.ShapeType() > TopAbs_FACE)
{
StdPrs_WFDeflectionShape::Add (thePrs, myshape, myDrawer);
break;
}

myDrawer->SetShadingAspectGlobal (Standard_False);
if (IsInfinite())
{
StdPrs_WFDeflectionShape::Add (thePrs, myshape, myDrawer);
break;
}

try
{
OCC_CATCH_SIGNALS
StdPrs_ShadedShape::Add (thePrs, myshape, myDrawer);
}
catch (Standard_Failure)
{
std::cout StdPrs_WFShape::Add (thePrs, myshape, myDrawer);
}
break;
}

Forum supervisor's picture

Dear Eric,
According our visualization expert opinion it is rather a bug in AIS_TexturedShape, caused by modifications performed in scope of issue #22971 "TKOpenGl clean up obsolete functionality".
The affected logic

if (!OwnDeviationAngle (newangle, prevangle) && !OwnDeviationCoefficient (newcoeff, prevcoeff))
{
break;
}

does not allow building presentations with default deviation parameters (as it was previously).
So, the new code in AIS_TexturedShape at least looks strange and requires further investigation.
We would appreciated if you would registered this issue in Mantis BugTracker, which is available
now via the Collaborative portal - http://dev.opencascade.org/index.php?q=home/get_involved.
It would be also very helpful to get a test case (shape) for this issue.
Regards

Forum supervisor's picture

Dear Eric,
The regression has been fixed in OCCT Git branch CR23385.
So, you are welcome to test the patch.
Details you can check at the Mantis BugTracker,
the issue - http://tracker.dev.opencascade.org/view.php?id=23385.
Regards