[vtkusers] vtk c++ - using classes with VTK
David Doria
daviddoria at gmail.com
Tue Nov 8 09:38:22 EST 2011
On Tue, Nov 8, 2011 at 9:28 AM, Hikaruchan
<Sandra.Schroetter.fl at ait.ac.at> wrote:
> 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
Can you show us the declaration of objactor? I'd assume it is
vtkSmartPointer<vtkActor> objactor
?
David
More information about the vtkusers
mailing list