problems with update/refresh


I use the occwindow from transparency demo and until now everything worked fine.

Now I started to move elements programmatically and that does not work. Well, the movement applied to the shapes works, but nothing happens on screen. I tried update(), updateView() and even direct call to paintGL() - the first both don't do anything and the last traps with "Default FBO wrapper creation failed".

When I use the mouse wheel to zoom in and out, I see the elements move - but only at the rate, I move the wheel.

What am I missing? How can I create a dynamic refresh rate, that is fast on action and sleeps if nothing happens?

When I move an element dragging with the mouse, there's no update/refresh problem. I can move as fast as I want - I see every move. Is it possible to simulate dragging with the mouse, so that I can achieve a smooth move?

Kirill Gavrilov's picture

Code sample on how you move shapes would be helpful.

When I move an element dragging with the mouse

The most straightforward way to drag something in AIS by mouse is to attach AIS_Manipulator (with AIS_Manipulator::SetModeActivationOnDetection(true)) to object or to sub-class interactive object and implement a draggable interface AIS_InteractiveObject::ProcessDragging().

DjangoReinhard's picture


I found the move-code here in forum. Function looks like:

void OcctQtViewer::moveShape(Handle(AIS_Shape) shape, double x, double y, double z) { gp_Trsf move; qDebug() << "moveShape: " << x << "/" << y << "/" << z; move.SetValues (1, 0, 0, x , 0, 1, 0, y , 0, 0, 1, z); myContext->SetLocation(shape, move); update(); }
Kirill Gavrilov's picture

When modifying main scene content, put also:


to ask Viewer to redraw full scene on next update as OcctQtViewer::update()/OcctQtViewer::updateView() performs a lazy update (through AIS_ViewController::FlushViewEvents()) by default.

DjangoReinhard's picture


Thank you very much for your help! That did the trick :) I thought I tested without luck InvalidateImmediate(), but maybe I remember wrong. Invalidate() works perfect.

Sorry, but may I ask you for help on my helix-problem? I'm helpless stuck :(