[vtkusers] Removing Actors

Cameron Burnett w_e_b_m_a_s_t_e_r_6_9 at hotmail.com
Mon May 5 11:52:48 EDT 2008


Put this line at the end and see if it does anything.

VTK3->GetRenderer()->Render();



From: rcpompeu at hotmail.com
To: frederic.danesi at dinccs.com
Date: Mon, 5 May 2008 15:20:36 +0000
CC: vtkusers at public.kitware.com
Subject: Re: [vtkusers] Removing Actors








I'm using a button to show/disappear an actor. 


Here's the code:

 

vtkCubeSource *cubo = vtkCubeSource::New();
    cubo->SetXLength(14);
    cubo->SetYLength(14);
    cubo->SetZLength(14);
    cubo->SetCenter(a/2,b/2,c/2);

  vtkPolyDataMapper *cuboMapper = vtkPolyDataMapper::New();
    cuboMapper->SetInput(cubo->GetOutput());

  vtkActor *cubo1 = vtkActor::New();
    cubo1->SetMapper(cuboMapper);
    cubo1->GetProperty()->SetColor(0.52, 0.27, 0);
    cubo1->GetProperty()->SetAmbient(0.2);
    cubo1->GetProperty()->SetDiffuse(0.3);
    cubo1->GetProperty()->SetSpecular(0.8);

 

if  (tbnCubo->Down) {                     // the button is down = the cube appears
    VTK3->GetRenderer()->AddActor(cubo1);

}

else {                                           // the button is up = the cube disappears 
    VTK3->GetRenderer()->RemoveActor(cubo1);
    VTK3->GetRenderer()->RemoveViewProp(cubo1);
    VTK3->GetRenderer()->Clear();

}

cubo->Delete();
cuboMapper->Delete();
cubo1->Delete();

VTK3->Invalidate();


When the button is up the actor does not disappear.

 

 

 



From: frederic.danesi at dinccs.com
To: rcpompeu at hotmail.com
Subject: RE: [vtkusers] Removing Actors
Date: Mon, 5 May 2008 17:01:17 +0200








Just a dumb question : is your outlineActor the same at each call or not ? … could you please provide us with more sourcecode (t least the code before your condition …) ?
Fred.
 



De : vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] De la part de Renato Cesar Pompeu
Envoyé : lundi 5 mai 2008 15:45
À : vtkusers at public.kitware.com
Objet : [vtkusers] Removing Actors
 
Hello All,
 

How do I remove an individual actor from the scene? My code does not work. Someone help me? Thanks.
 
if  (tbnIniciar->Down) {
  VTK3->GetRenderer()->AddActor(outlineActor);
  }
 
else {
    VTK3->GetRenderer()->RemoveActor(outlineActor);
    VTK3->GetRenderer()->RemoveViewProp(outlineActor);
    VTK3->GetRenderer()->Clear();
   }
 
VTK3->Invalidate();





Notícias direto do New York Times, gols do Lance, videocassetadas e muitos outros vídeos no MSN Videos! Confira já!
Conheça já o Windows Live Spaces, o site de relacionamentos do Messenger! Crie já o seu!

_________________________________________________________________
Never miss another e-mail with Hotmail on your mobile.
http://www.livelife.ninemsn.com.au/article.aspx?id=343869
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080506/9de55f41/attachment.htm>


More information about the vtkusers mailing list