[vtkusers] vtk3.2 crashes on Windows 2000

Mykola Khotyaintsev ko at nest.irfu.se
Thu Apr 11 07:55:06 EDT 2002


Dear vtkusers!

I have a serious problem using java vtk on Windows 2000.
The SimpleVTK works fine.
I try to visualize a satellite in my programme. Everything works fine when
I use vtkSphereSource, but when I try to create more complicated geometry
(see attached file test.java) the programme works fine, when the actor is
far away from the camera, but when I zoom in the programme crashes with
the following message:

-----------------------------------------------------------------------
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0xed92f00
Function name=DrvValidateVersion
Library=C:\WINNT\System32\mxicd.dll

Current Java thread:
        at vtk.vtkRenderWindow.Render_6(Native Method)
        at vtk.vtkRenderWindow.Render(vtkRenderWindow.java:36)
        at vtk.vtkPanel.Render(vtkPanel.java:118)

                             [skipped]
------------------------------------------------------------------------

I have tested my programme on different platforms including FreeBSD,
Linux, Solaris, Win95, 98, NT and it works fine.

Please help.

Thanks in advance,

Mykola Khotyaintsev                     [OVT Team]
                                   (http://ovt.irfu.se)
-------------- next part --------------
/** This programme crashes on Windows 2000 */

import vtk.*;
import java.awt.*;
import java.awt.event.*;

public class test {

public static void main (String[] args)
{
  Frame window = new Frame("Satellite");
  window.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
        System.exit(0);
      }
    });
  window.addNotify();


  vtkPanel renPanel = new vtkPanel();
  renPanel.setSize(400,400);
  window.removeAll();
  window.add(renPanel);

                // satellite size is 3m x 1.2m
                double cylinderHeight = 0.4;
                double cylinderRadius = 0.5;
                double coneHeight = 0.4;
                
                vtkPlane plane1 = new vtkPlane();
                plane1.SetOrigin(0, 0, -cylinderHeight/2);
                plane1.SetNormal( 0, 0, -1);
                
                vtkPlane plane2 = new vtkPlane();
                plane2.SetOrigin(0, 0, cylinderHeight/2);
                plane2.SetNormal( 0, 0, 1);    
                
                // align cylinder along Z
                vtkTransform cylinderTransform = new vtkTransform();
                    cylinderTransform.RotateX(90);
                
                vtkCylinder cylinder = new vtkCylinder();//it's cymetry axis is Y
                    cylinder.SetRadius(cylinderRadius);
                    cylinder.SetTransform(cylinderTransform);
                
                // align cone along Z and shift it up.
                vtkTransform coneTransform = new vtkTransform();
                    coneTransform.RotateY(90);
                    coneTransform.Translate(0, 0, cylinderHeight/2 + coneHeight);
                
                vtkCone cone = new vtkCone(); //it's cymetry axis is X
                    cone.SetAngle(10);
                    cone.SetTransform(coneTransform);
                
                vtkImplicitBoolean theCone = new vtkImplicitBoolean();
                    theCone.SetOperationTypeToIntersection();
                    theCone.AddFunction( cone );
                    theCone.AddFunction( plane2 );
                
                vtkImplicitBoolean theCylinder = new vtkImplicitBoolean();
                    theCylinder.SetOperationTypeToIntersection();
                    theCylinder.AddFunction( cylinder );
                    theCylinder.AddFunction( plane1 );  
                    theCylinder.AddFunction( plane2 );  
                
                vtkImplicitBoolean theSpacecraft = new vtkImplicitBoolean();
                    theSpacecraft.SetOperationTypeToUnion();
                    theSpacecraft.AddFunction( theCone );
                    theSpacecraft.AddFunction( theCylinder );
                
                
                // iso-surface to create geometry
                vtkSampleFunction theSpacecraftSample = new vtkSampleFunction();
                    theSpacecraftSample.SetImplicitFunction( theSpacecraft );
                    theSpacecraftSample.SetModelBounds(-cylinderRadius, cylinderRadius, -cylinderRadius, cylinderRadius, -(cylinderHeight/2+coneHeight), cylinderHeight/2);
                    theSpacecraftSample.SetSampleDimensions( 30, 30, 30);
                    theSpacecraftSample.ComputeNormalsOff();
                
                vtkContourFilter theSpacecraftSurface = new vtkContourFilter();
                    theSpacecraftSurface.SetInput( theSpacecraftSample.GetOutput() );
                    theSpacecraftSurface.SetValue( 0, 0);
                
                // map to graphics library
                vtkPolyDataMapper mapper = new vtkPolyDataMapper();
                    mapper.SetInput(theSpacecraftSurface.GetOutput());
                    mapper.ScalarVisibilityOff();
                
                vtkActor actor = new vtkActor();
                    actor.SetMapper(mapper);


  vtkRenderer ren1 = renPanel.getRenderer();
  ren1.AddActor(actor);
  ren1.SetBackground(1,1,1); // Background color white

  window.pack();
  window.setVisible(true);
}
}


More information about the vtkusers mailing list