[vtkusers] limitations using vtkAxesActor?

bnsteel bnsteel at gmail.com
Fri Apr 13 16:32:06 EDT 2012


hello,

I have been unsuccessful in using a vtkAxesActor in my application. And
wonder if there is some limitation that is not documented.

I have followed the tutorials to use both the Testing_Data_Bunny.vtp 
iconActor in the orientation widget and the sphere 
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/DisplayCoordinateAxes

My bunny showed up and worked fine, but when I swapped the bunny for the
vtkAxesActor as the orientation marker, I get a crash.	I have created a C++
dll that I am calling from a c# application.  I pass the handle of my render
window to the C++ class that handles the 3D data and vtk setup.  Everything
is working just fine except the axes actor!

               // axesWidget declared as
vtkSmartPointer<vtkOrientationMarkerWidget>  in .h
		axesWidget = vtkSmartPointer<vtkOrientationMarkerWidget>::New();
		vtkSmartPointer<vtkAxesActor> axes = vtkSmartPointer<vtkAxesActor>::New();
              // tried with and without label and text property setup here
as in tutorials
                axesWidget->SetOrientationMarker(axes); // works fine if
this is iconActor
                axesWidget->SetOutlineColor( 0.93, 0.57, 0.13 );
		axesWidget->SetInteractor(renWin->GetInteractor());
		axesWidget->SetViewport(0.0, 0.0, 0.25, 0.25);
                axesWidget->EnabledOn();	
		axesWidget->InteractiveOff();
                renWin->Render();

Everything is fine until I try to render.  Then I get the standard error
message about reading or writing restricted memory.

To simplify things, I try to just add a vtkAxesActor actor to my test
window:

       // added cone actor as in examples
	vtkSmartPointer<vtkAxesActor> axes = vtkSmartPointer<vtkAxesActor>::New();
	renderer->AddActor(axes); // comment out this line == no crash
        renWin->Render();

Again, it crashes when I try to render.  If I just don't add the
vtkAxesActor to the orientation marker or the renderer, everything is fine.   

The flow of my code is as follows:

Using a panel, m_panel, create a RenderWindowCotnrol Object as in Activiz
// C#
     m_RenderWindow = Kitware.VTK.vtkRenderWindow.New();
     m_RenderWindowInteractor = Kitware.VTK.vtkRenderWindowInteractor.New();
             
     Kitware.VTK.vtkInteractorStyleSwitch style =
this.m_RenderWindowInteractor.GetInteractorStyle()
         as Kitware.VTK.vtkInteractorStyleSwitch;
               
      if (null != style) style.SetCurrentStyleToTrackballCamera();
                
     m_RenderWindow.SetInteractor(this.m_RenderWindowInteractor);
     m_RenderWindow.SetParentId(m_panel.Handle);

// then send handle of render window to C++ object using SWIG object test3d
        test3d.setRenderWindow(RenderWindow.GetCppThis());

// in C++

void setRenderWindow(vtkRenderWindow *theWin){
	renWin = theWin;
	renderer = vtkSmartPointer<vtkRenderer>::New();
	renWin->AddRenderer(renderer);
	initWidgets(); // set up vtkOrientationMarkerWidge
	testAddActors(); // create cone actor, add to renderer, and then try to
render.
}

Is there anything that I am doing wrong?  Everything compiles fine.  I have
included vtkAxesActor.h and linked to vtkHybrid.lib and vtkWidget.lib.  It
did work just fine when I was using ActiviZ in C#, but it was too expensive
to move my 3D data from C++ where it is processed into C# for display.  I
thought it would be better to handle the data in C++ and just use C# for the
GUI.  The 3D is only a small portion of the main Application

Please let me know what additional information would help understand why the
renderer doesn't like vtkAxesActor .

Brooke

--
View this message in context: http://vtk.1045678.n5.nabble.com/limitations-using-vtkAxesActor-tp5639488p5639488.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list