Hi,
I'm new to Java3D. Using it for the first time and that too for my thesis.
I'm trying to draw a 3D drawing by reading the info from DXF file.
The shape will be a polygon. From 4 sided polygon to any number of sides.
I'm using IndexedLineStripArray to draw the drawing. My program is reading
all the values from the DXF files. Also it is calulating correct vertexcounts , 
stripcount etc.
However when I run the program it shows the following error.

java.lang.NullPointerException
 at 
javax.media.j3d.GeometryArrayRetained.setCoordinates(GeometryArrayRetained.java:2680)
 at javax.media.j3d.GeometryArray.setCoordinates(GeometryArray.java:976)
 at solarenvelope.SunLoc.createSceneGraph(SunLoc.java:128)
 at solarenvelope.SunLoc.main(SunLoc.java:74)

I have checked everything and not able to find out what it is.
Please, also let me know if there is any other method to draw polygon in Java3D.

I will highly appreciate if anyone can help me in this regard.

Here is the code I wrote. Its a part of the code I have written:


public class SunLoc {

    public SunLoc() { }

    public static void main( String[] args ) {


  JFrame controlFrame = new JFrame( "Control Frame" );
  controlFrame.setSize( 800, 600 );
  Container controlPane = controlFrame.getContentPane( );

  JFrame displayFrame = new JFrame( "Display Frame" );
  displayFrame.setSize( 1024, 800 );
  Container displayPane = displayFrame.getContentPane( );



  Canvas3D canvas = new Canvas3D( null );
  displayPane.add( canvas );



  SimpleUniverse univ = new SimpleUniverse( canvas );
  univ.getViewingPlatform( ).setNominalViewingTransform();



  BranchGroup scene = createSceneGraph( ); // Defined below
  univ.addBranchGraph( scene );



  controlFrame.addWindowListener(new WindowAdapter( ) {


    public void windowClosing(WindowEvent e) {
    // The event e is ignored
        System.exit( 0 );
           } // End of windowClosing
        } // End of inner class definition
   ); // End of 'add' call

      controlFrame.show( );
      displayFrame.show( );

 } // End main


public static BranchGroup createSceneGraph( ) {


           BranchGroup branch = new BranchGroup();
       try {
            File f1 = new File("d:/Drawing2.dxf");

        FileReader fr = new FileReader(f1);
        BufferedReader br = new BufferedReader(fr);
        DxfLoad dl = new DxfLoad();
        dl.dxfReaderF(br);

            Point3d[] vertices = new Point3d[dl.endIDf+1];

            for (int i=0 ; i<dl.endIDf; i++){
                vertices[i] = new Point3d(dl.pointf[i].x, dl.pointf[i].y, 
dl.pointf[i].z);
                }

             int[] vertexIndices = new int[10];
            for (int j=0; j<=dl.endIDf; j++){
                if(j != dl.endIDf){
                     vertexIndices [j] = j;
                    }
                    else{vertexIndices [j] = 0;}
                }


            int[] stripLengths = {(dl.endIDf+1)};

            IndexedLineStripArray lines = new IndexedLineStripArray(dl.endIDf , 
GeometryArray.COORDINATES, dl.endIDf+1, stripLengths );

            lines.setCoordinates(0, vertices);
            lines.setCoordinateIndices(0, vertexIndices);

            Shape3D shape = new Shape3D(lines);
            branch.addChild(shape);


        } catch(Exception e){
        e.printStackTrace();
         }

          return branch;

 }
 }

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to