Hi all,

I have been working on loading object geometry from a web server for a
project I'm working on. My approach is to specify the URL of the object and
the use the ModelLoader(NCSA) or ObjectFile(Sun) to grab the information
from the URL. The problem I keep getting is either an access violation
(ObjectFile) or a malformedURL(ModelLoader).

Thanks in advance for any assistance.

This is what I'm trying:

ObjectFile Method

public Scene loadModelFromURL( String modelLocation)
{
                URL                                linkUrl = null;
                Scene                        tempScene = null;
                try
                {
                        linkUrl = new URL( modelLocation );
                }
                catch (Exception e)
                {
                        System.err.println(e);
                        linkUrl = null;
                }

                int flags = ObjectFile.RESIZE;
                flags |= ObjectFile.STRIPIFY;
                double        creaseAngle = 60.0;

                if ( linkUrl != null )
                {
                        try
                        {
                                ObjectFile                objectFile = new
ObjectFile( flags, (float)(creaseAngle *
Math.PI / 180.0 ));
                                System.out.println("Loading object : " +
linkUrl);
                                tempScene = objectFile.load(linkUrl);
                                System.out.println("Finished");
                        }
                        catch (Exception e )
                        {
                                System.err.println(e);
                                tempScene = null;
                        }
                }
                else
                {
                        System.out.println("Unable to create geometry object due
to malformed
URL");
                }
                return tempScene;
}


ModelLoader method

        public BranchGroup loadModelURL2( String modelLocation )
        {
                URL                                linkUrl = null;
                BranchGroup                tempScene = null;

                try
                {
                        linkUrl = new URL( modelLocation );
                }
                catch (Exception e )
                {
                        System.err.println(e);
                        linkUrl = null;
                }

                try
                {
                        tempScene = modelLoader.load( linkUrl ).getSceneGroup();
                }
                catch ( Exception e )
                {
                        System.err.println(e);
                        tempScene = null;
                }

                return tempScene;
        }

--------------------------------------

Gregory G. Pierce






=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/

Reply via email to