Showing Results

Before switching our 3D viewing to Opencascade we used a standard OpenGL library.
For results we drew close to 100,000 quads of various colors and it management with only minor fatigue. We made a switch to Opencascade for the obvious benifits offered a few years back, but have not been able to print our results, because creating so many quads makes it unbelievably slow.
I assume it is because I am not taking advantage of something.
I was using BRepBuilderAPI_MakeFace
We have a cartesian grid, so all quads are perfect rectangles.
Does anyone know an easy way to display these results?
Thank you in advance.

Sharjith Naramparambath's picture

Hi Hamish,

When you use OpenGL to display triangles you are only building a graphics data structure for quads and sending to OpenGL which is quite simple and fast to display. However, when you build faces using OCC you are actually creating a huge topological datastructure and then OCC is computing the graphics for displaying the face. This graphic computation includes walking through the entire topological ds and generating the display and also computing the selection. This will obviously require more computation. If what you want to is only display the quads, I would suggest you to use your old method of OpenGL even if you use OCC for other computations in you application. You can use the same data in different ways for sending it to the OpenGL algo for display and to OCC for other computations. You may also consider using OCC's tessellation for generating data for the display.

Forum supervisor's picture

Hi Hamish,
Take into account, please that creation of a separate TopoDS_Face for each element of the mesh is definitive excess. Have a look at the package MeshVS that is dedicated to display of mesh objects.
Hope it can help you.
Regards

hamishl's picture

Thank you for your suggestion, I will look into MeshVS. I realize that creating the faces were excessive, but was hoping there was a simple way to draw a coloured quad.

hamishl's picture

Are there any available examples of using the MeshVS Class. I see the meshVS Overview in the documentation, but that's all I could find.

Thanks

Forum supervisor's picture

Hi Hamish,
In addition to Overview you may look to paragraph "4.5 AIS viewer – Mesh Visualization Service" of the Test Harness User's Guide. And also it will be useful to check file XSDRAWSTLVRML.cxx, which includes implementation of a set of Draw commands mentioned the paragraph 4.5.
Regards

hamishl's picture

This was very helpful, and I am now able to create triangles and it is fast enough. My only concern now is the best way to color individual triangles, do they all need to be in seperate Mesh classes.
I am using aMesh->GetDrawer()->SetColor(...), but if every triangle within a solid has a different color it would be easier if there was just a way to assign a color to the triangle, or even better the vertex.
Also I am just creating to triangles to make a Quad, there isn't another way to make a Quad is there (this isn't important, but would speed things up if there is just something I am missing)

Thank you again for all your assistance

Marco Nawijn's picture

Hello Hamish,

Reading your post, I have the impression that you are only dealing with meshes, not building them on top of a cad geometry. If this is the case, there might be other options that suite your case better. OpenCascade is a marvelous piece of software, but in my opinion pure mesh visualization is not the best showcase. Have a look at www.paraview.org. It is free, opensource and a fantastic companion to OCC.

Marco