[vtkusers] Problem with animating through Add-Remove Actor

richard.jurkovic at vi-motion.de richard.jurkovic at vi-motion.de
Thu Mar 13 05:58:28 EST 2003


 Hi all,

I'm making some animation tools, which read data for different position from
acsii file (coordinates file), exactly I'm reding only first position and
then
I compute others position (others coordinates). I simulate something like a
gear-wheel.
I declared
vtkActor *m_pActorB2DOutside[NUM_STEPS];
for ( i = 0; i < NUM_STEPS; i++ )
    m_pActorB2DOutside[i] = vtkActor::New();
where NUM_STEPS is for example 360 and actor is global variable
then localy I did inside loop
{
vtkPoints *l_pPointsB = vtkPoints::New();

vtkCellArray *l_pLinesB = vtkCellArray::New();

vtkPolyData *l_pPolyDataB = vtkPolyData::New();

vtkPolyDataMapper *l_pMapperB = vtkPolyDataMapper::New();

l_pPointsB->InsertPoint( j, l_coord.x, l_coord.y, l_coord.z );

l_pPolyDataB->SetPoints( l_pPointsB );

l_pPointsB->Delete();

then for cells (contour for wheel)

l_pLinesB->InsertNextCell( 2 );

l_pLinesB->InsertCellPoint( l_pIdxB[j] );

l_pLinesB->InsertCellPoint( l_pIdxB[j+1] );



l_pPolyDataB->SetLines( l_pLinesB );

l_pMapperB->SetInput( l_pPolyDataB );

l_pMapperB->ScalarVisibilityOff();

m_pActorB2DInside[i]->SetMapper( l_pMapperB );

l_pLinesB->Delete();

l_pMapperB->Delete();

l_pPolyDataB->Delete();

}

in rotating thread I only simply Remove actor last actor and AddActor last
actor +1

m_pRenderer->RemoveActor( m_pActorB2DInside[i] );

m_pRenderer->AddActor( m_pActorB3DInside[m_nLastStep] );

it works good, only my big problem is that the aplication is using still
more memory, then it start to swap ....

I don't understand this process and can't find nothing about how to solve
it.

Can anybody help me?

May be I'm using wrong way for animating, don't know.

Thanks

Richard







More information about the vtkusers mailing list