Using OpenCascade with OpenGL

Could someone tell me how to add calls to OpenGL Library in OpenCascade.

Many thanks


Gerard Gartside's picture

Can you explain more what you mean?

You can explore the shape you are trying to draw to get the wires on each face then use the OpenGL tesselation functions to triangulate the face and either draw it directly or build a call list to display later. Or if you are drawing wireframe just draw lines for each edge in the wire.

Or you could use the OpenCascade mesh functions to triangulate the shape and then use OpenGL to build triangles polygons to draw.

The OpenGL tesselation functions have the advantage that they can build triangle strips which will be more efficient to draw. It will also tell you whether the edge is an internal one or not which is useful if you are using OpenGL to do hidden line.


Sharjith Naramparambath's picture

Can you please tell me how to render direct OpenGL primitives into OpenCascade Viewer? eg. rendering glut primitives like cube, sphere torus etc. (the raw OpenGL code) into Cascade Viewer

N Sharjith

m-aronsson's picture

Hi !

That would be difficult, the OpenCascade visualization code does not use OpenGL, it is using a layer on top of OpenGL to do the rendering, so I don't think you can mix in OpenGL code with the visualation code, correct me if I am wrong here.


Lee Sangsu's picture


I have studied the possibility of mixing raw OpenGL functions with OCC, but At present I concluded it is very difficult. But If you look into source codes of the TKOpenGL package, you will find you can put your codes into it.(not so good idea, though)

Just look into the call_togl_redraw.c and call_togl_update.c files

Sangsu Lee