OCC with openGL / openVR? (student project)

Hi, I'm currently involved in a student project. We'd like to try implementing some basic CAD functionality in VR.

As a starting point we use a framework (rather a template) which is using openvr by valve. It uses OpenGL and therefore expects us to provide vertices for the visualization. The problem is that we'd like to mix the visualization of the mesh based VR world and CAD graphics, and we are evaluating how we can achieve this. I looked at the visualization user guide of opencascade and googled a bit, and it seems rather difficult to me. I did not find any point where we could hook in and grap the vertices to put into opengl. I understand that it is possible to get the tesselation of bodies and display them, but I think the selection feature of opencascade is unusable then and we'd have to do it ourselves? Is there any way to properly mix those visualizations and ideally make use of the selection feature?

I wonder if the Mesh Visualization Services are what we are searching for. But I'm not sure what is meant by pre/post processing data. To me it reads like the visualization of simulation data. Which is not our use case, but it may be still useful? (you'll have noticed that I still do not understand it properly). I also saw support for VTK. So I still have a little rest of hope that we may be able to use opencascade. If that is the case, I'd appreciate a hint for a good starting point.

Thank you in advance.

Kirill Gavrilov's picture

It uses OpenGL and therefore expects us to provide vertices for the visualization.

Open CASCADE Technology comes with its own 3D Viewer, which is based on OpenGL.
Of course, it is possible using OCCT just to receive triangulation and draw everything by your own, but I would not recommend it.
Writing own OpenGL viewer is quite complex task (if it is expected to be optimized, full of features, supporting many platforms).

OCCT 3D Viewer already supports rendering stereoscopic image, however it does not know anything about OpenVR yet.
You can either perform integration with OpenVR at application level or integrate its support into OCCT itself (after all, it is an open source project!).
Note that development portal https://dev.opencascade.org/ is a proper place for discussing OCCT development (if you will decide to participate).

Liang Zhang's picture

I'm not sure whether I got your point.

I know some companies use the modeling part of Opencascade and OSG(another open source project which focus on visualization) to display. They call some Opencascade API to get the triangulation data of bodies and code own functions to import them into OSG. Then use OSG's feature to select bodies.

Kirill Gavrilov's picture

I'm not sure whether I got your point.

In your first post you have talked about selection features in 3D Viewer.
Selection is a part of OCCT 3D Viewer functionality - it implements efficient data structures (BVH) and flexible logic.
The viewer itself can display shapes, triangulation and other kinds of data using OpenGL (or OpenGL ES on mobile platforms) through abstraction layer.
Standard presentation AIS_Shape allows displaying shape (TopoDS_Shape) without knowing topological structures in deep.

You can try CAD Assistant to see OCCT 3D Viewer capabilities:
https://www.opencascade.com/content/cad-assistant

So, as far as you do not HAVE to use other visualization library (VTK, OSG, anything else) for some reason
(e.g. you know specific library very well, or your application already uses it, or you need specific feature),
I suggest first spend some time for checking what OCCT 3D Viewer can do for you.