display with ais_coloredshape but properties transparency not work.

OCC : 7.0

OS: ubuntu 16.04.2 LTS

IDE: eclipse

I export a stl file to png picture, but It looks not pertty, as occ.png. The file freecad.png is the stl file in the freeCAD, and the magic.png is the stl file in the magic 19.01. I set the properties  Transparency to 0.0 or 1.0 ,but it seem the same. My source code is bellow, tks for your help.


void expShape2Png(TopoDS_Shape shape){
    // create a dummy display  connection 
    Handle(Aspect_DisplayConnection)  aDisplayConnection = new Aspect_DisplayConnection(); 
    // create a graphic driver 
    Handle  (Graphic3d_GraphicDriver) aDriver = new OpenGl_GraphicDriver(aDisplayConnection);     
    Handle  (Xw_Window) aWindow =  new Xw_Window (aDisplayConnection,  "My", 0,0,800,600);  
    // set up the window as  virtual 
    aWindow->SetVirtual  (Standard_True);  
    // create a view and an  interactive context 
    Handle  (V3d_Viewer) aViewer =  new V3d_Viewer (aDriver,                                
        Standard_ExtString ("Virtual"));  
    Handle  (AIS_InteractiveContext) aContext = new AIS_InteractiveContext (aViewer);  
    Handle  (V3d_View) aView = aViewer->CreateView ();  
    // assign the virtual window  to the view 
    aView->SetWindow  (aWindow);
    // display a 3D scene 
    Handle (AIS_ColoredShape) aBox = new AIS_ColoredShape (shape);
    Quantity_NameOfColor qnc = Quantity_NOC_BLACK;
    Quantity_Color  qc;
    Graphic3d_NameOfMaterial gam = Graphic3d_NOM_WATER;
    Graphic3d_MaterialAspect gma = gam;
    aContext->Display (aBox);

haizhao li's picture

Well  I got it,  it is not the properties  TRANSPARENCY, but DisplayMode work !!!




It is resolved !!!