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

Hikaruchan Sandra.Schroetter.fl at ait.ac.at
Tue Nov 8 09:28:29 EST 2011


No, but it is interesting that it seems that you can't see it (I see it
above). Strange...post it again ;-)

==========================================================
previous message with code
==========================================================
I made an VTK application which works great. But it is very long long code
in one class with many functions. So I tried to split up the VTK things into
serveral classes in my project. But then I got a problem with an access
violation error. As example what I am doing:

//class BrainModelVisualizer
//and here a function in the class which is called out from another class
void BrainModelVisualizer::initBrainModel(){
...
do some stuff here
...
//objactor is a member variable in the class
objactor = vtkSmartPointer<vtkActor>::New();
objactor->SetMapper(objmapper);
objactor->GetProperty()->SetOpacity( 0.15 );
}

//a getter is existing in the class BrainModelVisualizer
vtkSmartPointer<vtkActor> getBrainModelActor(){
	return this->objactor;
}


later I will need the "objactor" in another class, getting it via the
getBrainModelActor()-Function.

So the Problem now is, that when I try this shorten code above, I get an
access violation error in the line

objactor = vtkSmartPointer<vtkActor>::New();


I do not understand why. Is there anything wrong? I don't get it out. I hope
someone can help me, or tell me why it does not work.

Dear Hikaru 

==========================================================
end previous message with code
==========================================================

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



More information about the vtkusers mailing list