Drawing overlay


I 'am a new opencascade user.

I would like to draw 3d items over the opencascade rendering like a NavCube.
I do the rendering like opencascade examples (with AIS) in a QOpenGLWidget.
I try something like this:

void CadRenderWidget::paintGL()
    draw();// call Handle_V3d_View::Redraw

    if(m_pNavCube)// draw the NavCube

But my nav cube is not drawn. If I comment the first line, the opencascade scene
is always displayed, I have no control on rendering.
So I' am on the wrong way.

My truly questions are:
* How drawing 3d objects over the scene (= without Z order)?
* How drawing 3d objects like an HUD ?

Sorry for my english.


Kirill Gavrilov's picture

I don't know what m_pNavCube->draw() does, but I suppose this is something external OpenGL rendering code.
Mixture of low-level renderers is possible, but it is a tricky matter, so that you should try first using OCCT native tools before going outside.

For auxiliary elements like HUD, OCCT provides ZLayers like Graphic3d_ZLayerId_Topmost and Graphic3d_ZLayerId_TopOSD defining rendering order and depth buffer state,
as well as Graphic3d_TransformPers defining unusual object behavior in 3D viewer like placing it in the corner as trihedron or drawing 2D on-screen elements.