[vtkusers] Axes marker not working as expected

Júlio Hoffimann julio.hoffimann at gmail.com
Thu Dec 11 00:07:38 EST 2014


Dear all,

I'm trying to create a viewer widget with a QVTKWidget inside. For some
reason the axes marker is not fixed in the bottom left of the scene. It
moves together with the other objects (screenshot attached).

The code for the constructor is straightforward:

VTKViewer::VTKViewer(QWidget *parent) : QWidget(parent){
    QVTKWidget *qvtkwidget = new QVTKWidget;

    auto axes = vtkSmartPointer<vtkAxesActor>::New();
    axes->SetXAxisLabelText("x");
    axes->SetYAxisLabelText("y");
    axes->SetZAxisLabelText("z");

    auto orientationMarker = vtkSmartPointer<vtkOrientationMarkerWidget>::New();
    orientationMarker->SetInteractor(qvtkwidget->GetInteractor());
    orientationMarker->SetOrientationMarker(axes);
    orientationMarker->SetEnabled(1);

    // sphere
    auto sphereSource = vtkSmartPointer<vtkSphereSource>::New();
    sphereSource->SetCenter(8, 8, 8);
    sphereSource->SetRadius(5.0);
    auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
    mapper->SetInputConnection(sphereSource->GetOutputPort());
    auto actor = vtkSmartPointer<vtkActor>::New();
    actor->SetMapper(mapper);

    auto renderer = vtkSmartPointer<vtkRenderer>::New();
    renderer->AddActor(axes);
    renderer->AddActor(actor);

    vtkRenderWindow *renderWindow = qvtkwidget->GetRenderWindow();
    renderWindow->AddRenderer(renderer);}

Why the orientation marker is not behaving as expected? Does the order of
object creation in VTK matter (renderer, renderwindow, actors)? What should
be the lifetime for each object in the code snippet above?

I appreciate any help,
Júlio.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141210/bf5deb76/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot from 2014-12-09 14:19:32.png
Type: image/png
Size: 8703 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141210/bf5deb76/attachment.png>


More information about the vtkusers mailing list