[vtkusers] Axes marker not working as expected

Júlio Hoffimann julio.hoffimann at gmail.com
Thu Dec 11 12:39:12 EST 2014


Hi Bill,

The issue is somehow related to the order of object creation (renderer,
renderWindow, ...). If I move the renderer creation and renderWindow up in
the code before any axes setup, the axes shows correctly in the left
bottom. However, when I pass the mouse over the scene, the program crashes.
I also realized that we don't need to addActor(axes) by hand.

Do you have any idea on what can be causing the crash when I move the mouse
over the VTK widget area?

-Júlio

2014-12-11 4:46 GMT-08:00 Bill Lorensen <bill.lorensen at gmail.com>:

> This example puts the marker in its own viewport.
> http://www.itk.org/Wiki/VTK/Examples/Cxx/Widgets/OrientationMarkerWidget
>
>
> On Thu, Dec 11, 2014 at 12:07 AM, Júlio Hoffimann
> <julio.hoffimann at gmail.com> wrote:
> > 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.
> >
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the VTK FAQ at:
> > http://www.vtk.org/Wiki/VTK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://public.kitware.com/mailman/listinfo/vtkusers
> >
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141211/11e73172/attachment.html>


More information about the vtkusers mailing list