[vtkusers] Problem with rendering more than one vtk file

jsundar at siue.edu jsundar at siue.edu
Wed Sep 10 16:40:50 EDT 2003


   Hi all,
     I have a problem when I do the following.I am trying to read two vrml 
files that contain different objects into two vtkVRMLImporter objects.Then I 
try to extract the renderer of both objects,get the actorCollection of one and 
feed them to the renderer of the other.The purpose behind this is to merge the 
objects into a single renderwindow and to have some control in adding objects 
to the scene.I have not met with success and here is the code as well as the 
error.I have been able to add actors of Sphere to the vtkVRMLImporter's 
renderer successfully.Can anybody help me figure out the problem.
  Regards,
   Jayashree

Error
---------------------------------------------------------------------------
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0xAE8B302
Function=vtkTransformConcatenation::GetInverseFlag+0x3321E
Library=C:\PROGRA~1\vtk42\bin\vtkCommon.dll

Current Java thread:
        at vtk.vtkRenderer.AddActor_2(Native Method)
        at vtk.vtkRenderer.AddActor(vtkRenderer.java:20)
        at vtkFirstTrial.VrmlImportSecond.main(VrmlImportSecond.java:50)

Dynamic libraries:
0x00400000 - 0x00406000         C:\j2sdk1.4.0_02\bin\java.exe
0x77F80000 - 0x77FFB000         C:\WINNT\system32\ntdll.dll
0x7C2D0000 - 0x7C332000         C:\WINNT\system32\ADVAPI32.dll
0x7C4E0000 - 0x7C599000         C:\WINNT\system32\KERNEL32.DLL
0x77D30000 - 0x77D9E000         C:\WINNT\system32\RPCRT4.DLL
0x78000000 - 0x78045000         C:\WINNT\system32\MSVCRT.dll...

----------------------------------------------------------------------------
Code
package vtkFirstTrial;
import vtk.*;

public class VrmlImportSecond {
	static { 
			System.loadLibrary("vtkCommonJava"); 
			System.loadLibrary("vtkFilteringJava"); 
			System.loadLibrary("vtkIOJava"); 
			System.loadLibrary("vtkImagingJava"); 
			System.loadLibrary("vtkGraphicsJava"); 
			System.loadLibrary("vtkRenderingJava"); 
			System.loadLibrary("vtkParallelJava");
			System.loadLibrary("vtkHybridJava" );
		   }
	public static void main(String[] args) {
		vtkVRMLImporter vrmlImport = new vtkVRMLImporter();
		vtkVRMLImporter vrmlImport2 = new vtkVRMLImporter();
		
		vtkRenderWindow renWin = new vtkRenderWindow();
		
		renWin.SetSize(300,300);
	
		vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor
();
		try {
		
				vrmlImport.SetFileName
("C:\\vtkFirstTrial\\button.wrl");
				vrmlImport.SetRenderWindow(renWin);
				vrmlImport.Read();
				vrmlImport2.SetFileName
("C:\\vtkFirstTrial\\first.wrl");
				vrmlImport2.Read();
					
				
		        vtkRenderer ren1 = vrmlImport.GetRenderer();
		        vtkRenderer ren2 = vrmlImport2.GetRenderer();
		        vtkActorCollection acts = ren2.GetActors();
		        
		        System.out.println(acts.GetNumberOfItems());
		        for(int i = 0;i <(acts.GetNumberOfItems()-1);i++) {
				ren1.AddActor((vtkActor)acts.GetNextItem());
		      }
		      	       
				iren.SetRenderWindow(renWin);
				renWin.Render();
				
				iren.Start();
				
				
		
				}catch(Exception e) {
					e.printStackTrace();                 
				}
			}
		
	}


 
  


-------------------------------------------------
SIUE Web Mail



More information about the vtkusers mailing list