[vtkusers] Help with layers and interaction!

Chris Hughes chughes at informatics.bangor.ac.uk
Mon Jan 9 22:04:04 EST 2006


Hi Vtkusers,

I recently posted a message asking about how to composite an image into the
background and with your help I managed to find a solution which allowed me
to layer one renderer on top of another.

However, this has brought with it a few further problems which maybe you can
help me with? I am using Java.

1) The image in the background is formed from a vtkImageData type. However
this data is changing based on a simulation. Is it at all possible to redraw
the background without having to re render the 3d graphics in the
foreground? At the moment the only way I can find to do this is as shown in
this exert - although I am sure that there must be a better way to do this?

		vtkRenderWindow renWin = new vtkRenderWindow();
		renWin.SetNumberOfLayers(2);
		renWin.AddRenderer(ren2);
		renWin.AddRenderer(ren1);
		renWin.SetSize(640,480);
		ren1.SetLayer(0);
		ren2.SetLayer(1);

		for (int i = 1; i < 300; i++) {

			image.SetInput(new_image);
			ren2 = new vtkRenderer();
			ren2.AddActor(image);
			renWin.AddRenderer(ren2);
			ren1.SetLayer(0);
			ren2.SetLayer(1);
			renWin.Render();
			
		}

2) A vtkImageActor is used to render the background image. However when
rendered vtk scales it to half size, how can I make this fill the screen?
Also is it possible to make the vtkRenderWindow fullscreen?

3) On a slightly different topic I need to have the simulations continuing
whilst giving the user interaction. Is it possible to start the interaction
in a thread so that the simulation can run at the same time? And are there
any examples around? Also does the interaction allow you to capture
keypresses?

Many thanks for all of your help - any parts of the solution will be greatly
received. 

Chris




More information about the vtkusers mailing list