[vtkusers] Strange vtkPanel behaviour

Philip Cook pacook at blueyonder.co.uk
Sat Aug 25 10:46:12 EDT 2001


I have extended vtkPanel in one of my applications. The extension 
is an overridden mouseClicked(mouseEvent e) method: 

public void mouseClicked(mouseEvent e) {

  vtkPropPicker glyphPicker = new vtkPropPicker();
		
  int picked = glyphPicker.PickProp((double)e.getX(), 
rw.GetSize()[1] - (double)e.getY(), ren);
		
  // picked == 0 if picker did not pick an actor
  if (picked == 0) {
      super.mouseClicked(e);
      return;
  }
		
  vtkActor pickedActor = (vtkActor)glyphPicker.GetProp();
		
  int[] dataIndex = new int[3];
		
  try {
	 // This method finds the actor in a Hashtable and returns the    
      // associated index to the data from which the actor was 
created
      dataIndex = findGlyphFunctionIndex(pickedActor);
  }
  catch (GlyphNotFoundException ex) {
      System.out.println(ex.getMessage());
      return;
  }
		
  double[] glyphColour = pickedActor.GetProperty().GetColor();


  // This class extends java.awt.Frame and contains a vtkPanel.
 // It will create a new window and display an actor identical
 // to the one that was picked		
 // dataSet is a class variable that provides raw data for the
 // creation of glyphs
  VTKSingleGlyphImage popup = new 
VTKSingleGlyphImage(dataSet, dataIndex[0], dataIndex[1], 
dataIndex[2], glyphColour);	

}


When this method is called, some strange things happen. The new 
image always works the first time. However, on subsequent 
attempts the mouse click may cause Windows to freeze, pressing 
alt+ctrl+del causes a blue "System has become unstable" screen 
to appear.

Also, Sometimes the popup window appears OK, but the main 
window (where this extended panel is located) stops responding. 
Moving or clicking on the main window then causes it to go blank. 
Dragging the mouse over the blank window then causes the image 
that should be in the blank window to appear in the popup window! I 
can then rotate and zoom the image in the popup window by further 
clicks and drags on the blank window. Sometimes, minimising and 
then maximising the blank window will cause the image to come 
back where it should be.

I know VTK doesn't like actors, mappers etc being shared between 
windows, but I can't explain this behaviour because the renderers 
don't have anything to do with one another. The popup is a different 
class to the main image and each instance creates its own 
mappers, actors and renderers. None of them are static, so there 
shold be a separate mapper, actor etc for each instance of the 
popup window.

If I rotate or zoom the main window between picks, the problem 
doesn't seem to arise. I'm really baffled by this.

I am running Windows 98, VTK 3.2, and JDK 1.3.1. My graphics 
card is a Hercules Prophet II MX, with a GeForce II MX chipset. I've 
tried both Hercules and nVidia drivers, (v. 12.41) and the effect is 
the same.

Thanks for any help.




More information about the vtkusers mailing list