[vtkusers] vtkRnendererCollection problem with java

Simon Chatelain simon.chatelain at epfl.ch
Thu Aug 29 03:23:00 EDT 2002


Hello,

I have an java/VTK application. I'm using jdk 1.4.0 and VTK 4.0.
In my application, i have a vtkRenderWindow with some vtkRenderer with
different viewport.
Like in the vtkPanel class, i check the number of actors in the differents
renderer.

I try with two different methods:
1)

	vtkRendererCollection rcoll = this.rw.GetRenderers();
	rcoll.InitTraversal();

	int nbren = rcoll.GetNumberOfItems();
	int nbActor = 0;
	for (int i=0;i<nbren;i++)
	{
		vtkRenderer ren = rcoll.GetNextItem();
		nbActor += ren.VisibleActorCount();
	}
	return nbActor;

this methods create (often but not always) the following exception:

	An unexpected exception has been detected in native code outside the VM.
	Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0xAE3E4B0
	Function=vtkCollection::GetNumberOfItems+0x0
	Library=C:\WINDOWS\System32\vtkCommon.dll

	Current Java thread:
        at vtk.vtkCollection.GetNumberOfItems_8(Native Method)
        at vtk.vtkCollection.GetNumberOfItems(vtkCollection.java:44)
        at VTKPanel.visibleActor(VTKPanel.java:53)
        - locked <02FF16F0> (a VTKPanel)
        at VTKPanel.Render(VTKPanel.java:105)
        - locked <02FF16F0> (a VTKPanel)
        at vtk.vtkPanel.paint(vtkPanel.java:51)
        at sun.awt.RepaintArea.paint(RepaintArea.java:180)
        at
sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:260) ...

I try with an another method :
2)
	vtkRendererCollection rcoll = this.rw.GetRenderers();
	rcoll.InitTraversal();
	vtkRenderer ren = rcoll.GetNextItem();

	int nbActor = 0;
	while (ren != null)
	{
		nbActor += ren.VisibleActorCount();
		ren = rcoll.GetNextItem();
	}

this methods create (often but not always) the following exception:

	An unexpected exception has been detected in native code outside the VM.
	Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0xB65A3E6
	Function=Java_vtk_vtkRendererCollection_GetNextItem_13+0x16
	Library=C:\WINDOWS\system32\vtkRenderingJava.dll

	Current Java thread:
	 at vtk.vtkRendererCollection.GetNextItem_3(Native Method)
	 at vtk.vtkRendererCollection.GetNextItem(vtkRendererCollection.java:24)
	 at VTKPanel.visibleActor(VTKPanel.java:56)
	 - locked <02FFE3C0> (a VTKPanel)
	 at VTKPanel.Render(VTKPanel.java:104)
	 - locked <02FFE3C0> (a VTKPanel)
	 at vtk.vtkPanel.paint(vtkPanel.java:51)
	 at sun.awt.RepaintArea.paint(RepaintArea.java:180) ...

This exception occurs only on during the second call to GetNextItem().

Can someone help ?

Thanks.




More information about the vtkusers mailing list