Display dynamic (changing) graphics


I have to display 3d points that are generated dynamically (anytime some input device is moved).
So I've created a class inheriting AIS_InteractiveObject and redefined Compute(Handle_PrsMgr_PresentationManager3d, Handle_Prs3d_Presentation, ...) method.

This sub-class relies on a Graphic3d_ArrayOfPrimitives being filled with specific purpose addPoint() :

class AIS_Path : public AIS_InteractiveObject
AIS_Path(Standard_Integer maxPoints)
: m_points(new Graphic3d_ArrayOfPolylines(maxPoints))

void addPoint(const gp_Pnt& pnt)

void Compute(const Handle_PrsMgr_PresentationManager3d& pm,
const Handle_Prs3d_Presentation& pres,
const Standard_Integer mode)
Handle_Graphic3d_Group group = Prs3d_Root::CurrentGroup(pres);
if (group.IsNull())


void ComputeSelection(const Handle_SelectMgr_Selection& selection, const Standard_Integer mode)
{ }

Handle_Graphic3d_ArrayOfPrimitives m_points;

Each time a new point is added AIS_InteractiveContext::RecomputePrsOnly() is called and then Update() but only the points added with addPoint() before the very first call to Display() can be seen, after that nothing is displayed.

How should I proceed to get things work ?

Hugues Delorme's picture

I still have no solution with this issue.

How can we force OpenCascade to display dynamic graphics ?

I'm using OCC v6.6.0 and in Graphic3d_Group.hxx there is some doc about "main group usage models" :

1) Non-modifiable, or unbounded, group ('black box')
2) Bounded group (...) Such a group have simplified organization in memory (a single block of attributes followed by a block of primitives) and therefore it can be modified

How to change the primitive array (eg. AddVertex()) inside a Graphic3d_Group and update the display automatically ?

Marco Nawijn's picture

Hi Hugues,

I know this is an OCC forum and don't want to move you away from it, but if you only have to deal with points I think OCC is not the proper tool. Are you aware of VTK and it's GUI bindings to for example Qt? It would be quite straighforward to implement dynamic graphics with points with it (it has excellent Python bindings too).



Hugues Delorme's picture

Hello Marco,

Thanks for the advice, but I would like to stay with OpenCascade as I need to display part files (STEP, IGES, ...).
What at least I would like to known is whether or not it's possible to display dynamic graphics with OpenCascade.
Any trick or workaround would be of great help.