Should I give up OpenCascade ?

I've tried to display many spheres or many points. First by creating my own AIS_InteractiveObject with a group that holds 9000 markers. The speed was very slow. So I tried just displaying 9000 little spheres and my computer crashed.

This is my compute method for my own AIS_InteractiveObject :

void User_Point::Compute(const Handle_PrsMgr_PresentationManager3d& aPresentationManager,const Handle_Prs3d_Presentation& aPresentation,
const Standard_Integer aMode )

Handle(Graphic3d_Structure) theStructure = Handle(Graphic3d_Structure)::DownCast(aPresentation);

Handle(Graphic3d_Group) theGroup= new Graphic3d_Group(theStructure);

Handle(Graphic3d_AspectMarker3d) asp;
asp = myDrawer->PointAspect()->Aspect();

asp->SetType(Aspect_TOM_BALL );
int i;

Quantity_Color color;
double dble;
for(i = points->Lower();iUpper();i++)
dble = attribute[i];
myColorScale->FindColor(dble, color);

So before giving up OpenCascade, I'd like to know if some one has an idea for a way to improve the speed of the grapics.
Thank you very much for your answer!!!


Patrik Mueller's picture

Hi Philippe,

perhaps you can use Graphic3d_Array1OfVertex for storing you points?



DELORME's picture

As already said in another thread, your problem is you want to display vertices with different colors but you can't display them in a bunch.
What you should try is to group vertices with similar colors in arrays of type Graphic3d_Array1OfVertex. Then for each array you set the aspect's color and display that array with Graphic3d_Group::MarkerSet().
If you want to work only with vertices, I think that the only easy way to really improve performance.
Another way that you can consider is to use quadrangles or triangles as the dislay primitive instead of vertices. Does it really matter to display vertices instead of e.g. triangles? If not you can compute an average color for every triplets(or quadriplets) of vertices neighbours, group those items along their color and set the "3d fill area color" for each group. Take a look at routines Graphic3d_Group::QuadrangleMesh() and TriangleMesh() and also the class Graphic3d_AspectFillArea3d.

I used recently this last solution to display the crests that remain after a complete machining tool path, it works fine.