<div dir="ltr">Hi Bill,<div><br></div><div>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.</div><div><br></div><div>Do you have any idea on what can be causing the crash when I move the mouse over the VTK widget area?</div><div><br></div><div>-Júlio</div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-12-11 4:46 GMT-08:00 Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This example puts the marker in its own viewport.<br>
<a href="http://www.itk.org/Wiki/VTK/Examples/Cxx/Widgets/OrientationMarkerWidget" target="_blank">http://www.itk.org/Wiki/VTK/Examples/Cxx/Widgets/OrientationMarkerWidget</a><br>
<div><div class="h5"><br>
<br>
On Thu, Dec 11, 2014 at 12:07 AM, Júlio Hoffimann<br>
<<a href="mailto:julio.hoffimann@gmail.com">julio.hoffimann@gmail.com</a>> wrote:<br>
> Dear all,<br>
><br>
> I'm trying to create a viewer widget with a QVTKWidget inside. For some<br>
> reason the axes marker is not fixed in the bottom left of the scene. It<br>
> moves together with the other objects (screenshot attached).<br>
><br>
> The code for the constructor is straightforward:<br>
><br>
> VTKViewer::VTKViewer(QWidget *parent) : QWidget(parent)<br>
> {<br>
>     QVTKWidget *qvtkwidget = new QVTKWidget;<br>
><br>
>     auto axes = vtkSmartPointer<vtkAxesActor>::New();<br>
>     axes->SetXAxisLabelText("x");<br>
>     axes->SetYAxisLabelText("y");<br>
>     axes->SetZAxisLabelText("z");<br>
><br>
>     auto orientationMarker =<br>
> vtkSmartPointer<vtkOrientationMarkerWidget>::New();<br>
>     orientationMarker->SetInteractor(qvtkwidget->GetInteractor());<br>
>     orientationMarker->SetOrientationMarker(axes);<br>
>     orientationMarker->SetEnabled(1);<br>
><br>
>     // sphere<br>
>     auto sphereSource = vtkSmartPointer<vtkSphereSource>::New();<br>
>     sphereSource->SetCenter(8, 8, 8);<br>
>     sphereSource->SetRadius(5.0);<br>
>     auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New();<br>
>     mapper->SetInputConnection(sphereSource->GetOutputPort());<br>
>     auto actor = vtkSmartPointer<vtkActor>::New();<br>
>     actor->SetMapper(mapper);<br>
><br>
>     auto renderer = vtkSmartPointer<vtkRenderer>::New();<br>
>     renderer->AddActor(axes);<br>
>     renderer->AddActor(actor);<br>
><br>
>     vtkRenderWindow *renderWindow = qvtkwidget->GetRenderWindow();<br>
>     renderWindow->AddRenderer(renderer);<br>
> }<br>
><br>
> Why the orientation marker is not behaving as expected? Does the order of<br>
> object creation in VTK matter (renderer, renderwindow, actors)? What should<br>
> be the lifetime for each object in the code snippet above?<br>
><br>
> I appreciate any help,<br>
> Júlio.<br>
><br>
</div></div>> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
><br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
--<br>
Unpaid intern in BillsBasement at noware dot com<br>
</font></span></blockquote></div><br></div>