Painting different shapes all at once

We want to create multiple shapes all at once and we're doing that by now in a code like this (it is simplified):

for(int i=0; i {
Handle(AIS_Shape) interactiveShape=letsGetTheShape(i);


the problem we're facing is that with large N's we're getting very slow painting and a quite strange effect (we can see how every shape is painted which is funny just the first time you see it :P).

My intuition suggested me that passing a the second ::Display() parameter only in the i==N case so that the update would be triggered just on the last case. This didn't work, I'm not sure why, we still can see the repainting (why? the viewer update is false!).

Anyway, any hint on what could we do to fix that issue?


Paul Jimenez's picture

AIS is well known for being slow. Two commonly suggested tricks to get a faster response are: using as few InteractiveObjects as possible (you could, for example, put a lot of shapes into a Compound, then just display the Compound) and updating the viewer only after you're done with a bunch of operations that may cause an update by passing Standard_False to the updateviewer parameter in all of the methods of AIS_InteractiveContext you call (that have such parameter), except the last one (either that, or always passing Standard_False and do a single call to update the viewer at the very end).

You say you're using the last trick now. Isn't there any performance gain at all after you did that?

apol's picture

We've tried this Compound trick but we can't use it right now, at least without workarounding the whole program's shape selection process.

And yes, the update parameter looks pretty useless. :S just looks like it doesn't paint faces until another Display call is triggered, so when we have lots of Display's we still can see the repainting...

Any other idea?


Paul Jimenez's picture

Maybe you're calling another method that updates the viewer, and you haven't realized that. Check carefully all methods you're calling, and be sure the ones that update the viewer are given Standard_False for that parameter.