I want to use vtkOrientationMarkerWidget(named “widget”) in my viewer widget which is derived from QVTKOpenGLNativeWidget. I try to call widget->SetCurrentRenderer(m_render). But widget can not display in my viewer. And alse, I try to call om->SetInteractor(GetInteractor()). But it’s failed. I can control the scene of my viewer with mouse and keyboard. That’s my part of the source code. Thanks in advance.
According to your code, I define the oject ‘vtkOrientationMarkerWidget’ as a member variable of the class MyViewer instead of local variable in the function. It works! That’s the reason why I can not see the result. Thank you very much!
Yes… I took some time to realize that the smart pointer was being deallocated along with its scope and taking the object with it. The solution was to make it a member variable so it lives as long as the application is running.