[vtkusers] vtk c++ - using classes with VTK

Hikaruchan Sandra.Schroetter.fl at ait.ac.at
Wed Nov 9 08:11:53 EST 2011


I have tried to return a normal Pointer instead of the SmartPointer. Now I
worked it out to split my project into several classes. The returning of
SmartPointer using get-functions works in most of them, but in one class it
don't work with a getter-function. Don't understand why. 

I solved it, with returning directly, using the actor as local variable (and
not as member variable as before). Now it works.

vtkSmartPointer<vtkActor> BrainModelVisualizer::initBrainModel(){

        //read a obj file, transform it and visualize it
        ....

        //it works with the local variable which is returned directly 
        //not working when using a member variable and returning it via a
get-function
	vtkSmartPointer<vtkActor> objactor = vtkSmartPointer<vtkActor>::New();
	objactor->SetMapper(objmapper);
	objactor->GetProperty()->SetOpacity( 0.15 );

	return objactor;

}

--
View this message in context: http://vtk.1045678.n5.nabble.com/vtk-c-using-classes-with-VTK-tp4974099p4977631.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list