[vtkusers] Actors disappeared after switching windows

Luke Hua luke_qz at yahoo.com
Tue Mar 2 11:53:22 EST 2004


I have similar problem. I was wondering can vtk provide some tool to debug this kind of problem.
 
For me, it looks like a memory problem. 
 
                                                                      Luke

rchqh at polyu.edu.hk wrote:
Dear VTK users,
I am programming with VTK 4.0. I tried to add several actors into a renderer
as follows.

vtkActor *actor[3];
actor[0] = vtkActor::New();
actor[1] = vtkActor::New();
actor[2] = vtkActor::New();
vtkPlaneSource *plane[3];
plane[0] = vtkPlaneSource::New();
plane[1] = vtkPlaneSource::New();
plane[2] = vtkPlaneSource::New();
vtkPolyDataMapper *pMapper[3];
pMapper[0] = vtkPolyDataMapper::New();
pMapper[1] = vtkPolyDataMapper::New();
pMapper[2] = vtkPolyDataMapper::New();
vtkTexture *text[3];
text[0] = vtkTexture::New();
text[1] = vtkTexture::New();
text[2] = vtkTexture::New();
plane[0]->SetOrigin(,,,);
plane[0]->SetPoint1(,,,);
plane[0]->SetPoint2(,,,);
plane[1]->SetOrigin(,,,);
plane[1]->SetPoint1(,,,);
plane[1]->SetPoint2(,,,);
plane[2]->SetOrigin(,,,);
plane[2]->SetPoint1(,,,);
plane[2]->SetPoint2(,,,);
pMapper[0]->SetInput(plane[0]->GetOutput());
pMapper[1]->SetInput(plane[1]->GetOutput());
pMapper[2]->SetInput(plane[2]->GetOutput());
text[0]->SetInput(imagedata0);
text[1]->SetInput(imagedata1);
text[2]->SetInput(imagedata2);
actor[0]->SetMapper(pMapper[0]);
actor[1]->SetMapper(pMapper[1]);
actor[2]->SetMapper(pMapper[2]);
actor[0]->SetTexture(text[0]);
actor[1]->SetTexture(text[1]);
actor[2]->SetTexture(text[2]);

actor[0]->RotateX(90);
actor[1]->RotateY(-90);
actor[2]->SetPosition(,,,);

ren->GetActors()->RemoveAllItems(); //ren is a vtkRenderer defined in
other part of my program
ren->AddActor(actor[0]);
ren->AddActor(actor[1]);
ren->AddActor(actor[2]);

renWin->Render(); //renWin is a vtkRenderWindow defined in other part of
my program;ren is the only renderer in this window

The program worked very well and the actors were displayed properly.However,
after I switched to other windows using Alt+Tab and switched back to my vtk
window, two actors disappeared.I also found the only actor left in the
renderwindow had incorrect position and size. Did anyone meet same problem
as mine? Could you help me?
Any reply is appreciated.
Thanks in advance!

HW Wong


_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at: 
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers



---------------------------------
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040302/e3992e9c/attachment.htm>


More information about the vtkusers mailing list