Thanks a lot Evan. The code worked and i am able to get the geometry array. But there 
is a problem after that.
Im trying to get the trianglearray set and modify the attributes to few arrays. This 
is how im doing
 
GeometryArray ga = (GeometryArray)geometries.nextElement();
TriangleArray  count = (TriangleArray)ga;
Point3f[] coordinates = new Point3f[count.getVertexCount()];
count.getCoordinates(0, coordinates); 
 
But here i get the error 
java.lang.IllegalStateException: GeometryArray: cannot directly access data in 
BY_REFERENCE mode.
 
I know this is a bug in Java3D 1.3. Can someone tell me how I can overcome this 
problem.
 
Henu
 
 

        -----Original Message----- 
        From: Ewan Borland [mailto:[EMAIL PROTECTED] 
        Sent: Sun 10/5/2003 7:29 AM 
        To: [EMAIL PROTECTED] 
        Cc: 
        Subject: Re: [JAVA3D] getting polygon array for object file
        
        

        Finding specific nodes in a loaded model is a common problem. I use this
        utility class (NodeFinder.java attached) to find the node I want. For your
        purpose something simliar to the example below should suffice.
        
        -Ewan
        
        // Load the model
        ObjectFile myLoader = new ObjectFile();
        Scene myScene = myLoader.load("your filename/url here");
        
        // Get the root of the scene
        Node myRootNode = myScene.getSceneGroup();
        
        // Temp enumerations for shapes and geometries
        Enumeration shapes = null;
        Enumeration geometries = null;
        
        // Find all of the Shape3D nodes that comprise this model
        try { shapes = NodeFinder.findNodes(myRootNode,
        "javax.media.j3d.Shape3D"); }
        catch(ClassNotFoundException e) { e.printStackTrace(); }
        
        // Handle each shape in turn
        while (shapes.hasMoreElements())
        {
            // Retrieve all of the geometry node components from the shape
            geometries = ((Shape3D)shapes.nextElement()).getAllGeometries();
        
            // Handle each piece of geometry in turn
            while (geometries.hasMoreElements())
            {
                // Recover the next geometry component
                GeometryArray ga = (GeometryArray)geometries.nextElement();
        
                ... now do whatever you like with the GeometryArray object
            }
        }
        
        
        ----- Original Message -----
        From: "Madeti, Henu S. (UMR-Student)" <[EMAIL PROTECTED]>
        To: <[EMAIL PROTECTED]>
        Sent: Sunday, October 05, 2003 1:51 AM
        Subject: [JAVA3D] getting polygon array for object file
        
        
        >
        >
        > Hi all,
        >
        > We have the objload.java loading a obj file. I wish to set different
        appearances for different polygons of the obj file. So can someone tell me
        how to get the polygon(geometry array) from the object file.
        >
        > thanks
        > Henu
        >
        >
        
        ===========================================================================
        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