Fast Display 100 shaded Cylinder ?

Hello, everyone:

I write a test program to display 100( 10 * 10 array) cylinder in OCC viewer. For each cylinder I use BRepPrimAPI_MakeCylinder to create a TopoDS_Shape then new a AIS_Shape to display it. The performance is very poor. I can see the whole process just as an animation.

Maybe we can use different method to viusalize cylinder at 1000 magnitude, or temporary turn off the display of viewer and after the overall call finished, just to call UpdateCurrentViewer()? I have test the last idea with Display(aShape, False), but it doesn't function.

Francois Lauzon's picture

Hi fhchina,
displaying all your cylinder shape with AIS_InteractiveContext::Display(aShape,Standard_False) and then calling AIS_InteractiveContext::UpdateCurrentViewer() should work, at least it's working for us.

Francois.

François Lauzon, Ing. Stag.
Software Development Coordinator
DBM Reflex Inc.
1620 boul. Dagenais ouest
Laval, Québec
Email: Francois.Lauzon@dbmreflex.com

fhchina's picture

Thank you, Lauzon. I make a mistake first about the use of Display(aShape, Standard_False).

Now in my code we will not see the 'animation'. But the speed is still not very satisfying. I change with sample code User_Cylinder.cxx, but there is no performance enhancement.

I want to try this demo with Coin3D. Any suggestion will be appreciated.

Lugi.C's picture

The same problem with me.
If you use another version of Display of AIS_InteractiveContext, you will get a little better results.
Regards.

fhchina's picture

With version? The one with more parameters? I have a look at their codes, the less parameter one just have an extra GetDefMode call, the others seem identical. GetDefMode seems impossible to be bottleneck.

One strange thing is whichever display mode, i.e. AIS_WireFrame or AIS_Shaded, is both with bad performance.

Math's picture

Hi,

You should create your 100 cylinders, add them in a compound, create an AIS_Shape from this compound and then display it ...

The problem is that each AIS shape is an openGL group. To improve graphic performances, you have to minimize the number of groups ...

Mathias