[vtkusers] GUI grayout -- Further

R K Shyamprakash ramakrishna.prakash at quest-global.com
Wed Jul 16 03:49:05 EDT 2003


Further to my previous mail, say, the problem occurs during the operation in
vtk window no.3. now if I destroy this window, then everything returns to
normal. following is the code where I destroy the window.

public void destroy() {
	clearViewer();
	Lock();
	rw.RemoveRenderer(ren);
	rw.SetInteractor(null);
	removeWindowSetObserver(winObserver);
	ren.SetRenderWindow(null);
	ren = null;
	UnLock();
}

after destroying the window, I create a new instance of the viewer(which
extends vtkPanel) and add it to the respective parent container like

	tabbedPane.getComponentAt(2).remove(viewer);  //tabbed pane is JTabbedPane
							//getComponentAt returns JPanel which contans the viewer
	viewer = new ModelViewer();                              //ModelViewer
extends vtkPanel
	tabbedPane.getComponentAt(2).add(viewer);

Thanks
Shyam



Hello,
	I have developed an application which has 4 render windows. I will be
adding and removing the actors frequently.If I continue the operation long
enough, say 10 minutes, the GUI of the application(menubar, toolbar, tabs of
the tabbedpane, statusbar etc gets grayedout) freezes but interestingly the
vtkwindow remains intact. I can still rotate, pan the 3d object. following
is the code where I remove actors.

public void clearViewer(){
	Lock();
	vtkActor temp = null;
	vtkActorCollection collection = GetRenderer().GetActors();
	if (collection == null) {
		return;
	}

	int numActors = collection.GetNumberOfItems();

	collection.InitTraversal();
	for (i = 0; i < numActors; i++) {
		temp = collection.GetNextActor();
		if (temp != null) {
			GetRenderer().RemoveActor(temp);
			//temp.ReleaseGraphicsResources(rw); uncommenting this line didn't help
		}
	}
	ren.Clear();  //ren id vtkRenderer
	UnLock();
}

Is there anything else I should take care while clearing the renderer or its
some thing else? Any suggestions will be of great help. I am using vtk 4.2
with Java 1.4.1_02.

Thanks
Shyam




More information about the vtkusers mailing list