Fri, 10/06/2023 - 16:59
Hi gentlemen, I have some VERY OLD codes to show faces's front and back sides in different colors. The codes like :
aPrs = new Prs3d_Presentation(myAISContext->CurrentViewer()->Viewer());
Handle (Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(aPrs);
Handle(Graphic3d_AspectFillArea3d) myFillAspect = new Graphic3d_AspectFillArea3d();
myFillAspect->SetInteriorStyle (Aspect_IS_SOLID);
myFillAspect->SetDistinguishOn ();
myFillAspect->SetEdgeOn();
myFillAspect->SetEdgeLineType(Aspect_TOL_SOLID);
myFillAspect->SetEdgeColor(Quantity_NOC_BLACK);
myFillAspect->SetEdgeWidth(1);
Graphic3d_MaterialAspect myFrontMaterial(Graphic3d_NOM_DEFAULT);
myFrontMaterial.SetColor (Quantity_NOC_RED);
myFillAspect->SetFrontMaterial(myFrontMaterial);
Graphic3d_MaterialAspect myBackMaterial(Graphic3d_NOM_DEFAULT);
myBackMaterial.SetColor (Quantity_NOC_GOLD);
myFillAspect->SetBackMaterial(myBackMaterial);
myFillAspect->SetInteriorColor (Quantity_NOC_RED);
myFillAspect->SetBackInteriorColor (Quantity_NOC_GOLD);
aGroup->SetPrimitivesAspect(myFillAspect);
aGroup->AddPrimitiveArray(aTrianglesArray); // aTrianglesArray is an array with many triangles
aPrs->Display();
But the problem is:
If this code based on OCC 6.3.0 , it works OK. The one side of the faces is RED, the other side is GOLD.
If this code based on OCC 7.1.0, it cannot show the faces' back color.
When I followed some OCC 7.1.0 samples and simplify the code like followed still not work, the both sides of every faces are RED color.
......
Handle(Graphic3d_AspectFillArea3d) myFillAspect =
new Graphic3d_AspectFillArea3d ( Aspect_IS_SOLID, Quantity_NOC_RED, Quantity_NOC_BLACK,
Aspect_TOL_SOLID, 1, Graphic3d_NOM_DEFAULT, Graphic3d_NOM_DEFAULT );
myFillAspect->SetEdgeOn();
myFillAspect->SetDistinguishOn ();
myFillAspect->SetInteriorColor ( Quantity_NOC_RED );
myFillAspect->SetBackInteriorColor ( Quantity_NOC_GOLD );
aGroup->SetPrimitivesAspect(myFillAspect);
aGroup->AddPrimitiveArray(aTrianglesArray);
.......
Why? Did I miss something?
Thank for help!
Fri, 10/06/2023 - 19:57
Your code snippet works as expected on my sample with OCCT 7.7.0.
Please share more code to figure out what might be wrong and please use tags to insert code samples on the Forum.
Sun, 10/08/2023 - 17:46
Thanks for answer! I upload my codes and some pictures!
Your code and picture confirmed me that perhaps my code is right. So I wonder maybe something wrong with the OCCT 7.1.0's dlls (Those dlls are combined from source code by myself), then I downloaded the opencascade-7.1.0-vc10-64.exe from opencascade.org , installed it, BUT it is still not work. I'm confused. Will it be a bug of the OCCT 7.1.0?
Because my project is complex, I cannot use OCCT 7.6.0 to test it now.
I need to explain something in detail:
The source code is read triangle's data from a file, insert them into a vector, then show them.
The picture show red and gold color is based on OCCT 6.3.0, the picture only show red is based on OCCT 7.1.0
Sun, 10/08/2023 - 15:29
Sun, 10/08/2023 - 15:30
Thanks a lot!