I have uploaded the 3D-tutorial applet EarthApp (slightly modified) to the
internet but I can't get it to load the image file, earth.jpg. I have tried
using the relative path for the image file (option 1) as well as the
absolute path (option 2). I have also tried creating a URL from the absolute
path (option 3). None of these work in appletviewer or Internet Explorer 5.
To my astonishment, however, if I use appletviewer and there is a copy of
earth.jpg in my current local directory, option 1 works! I didn't think
applets had automatic permission to read files on the local host computer!
Be that as it may, I need the applet to use the image file located on the
internet so that anyone can run it -- not just someone who happens to have a
personal copy of earth.jpg.

The code that attempts to load the image follows. Go ahead and run the
applet at http://www.erols.com/quantime/earthApp/EarthApp.html and see if
you get any better results. I would sure like to know what's going on!

Please, does anyone know a way to load an image into a texture that works?

Thanks, Raffi

My html file, image file and class file are all in the same folder:
http://www.erols.com/quantime/earthApp/EarthApp.html
http://www.erols.com/quantime/earthApp/earth.jpg
http://www.erols.com/quantime/earthApp/EarthApp.class

/********************************/

String filename = null;
URL url = null;
TextureLoader loader = null;
ImageComponent2D image = null;
try{            //OPTION 1
        filename = "earth.jpg";
        loader = new TextureLoader( filename, this );
        ImageComponent2D tempImage = loader.getImage();
        System.out.println( "option 1 succeeded." );
        image = tempImage;
}catch( Exception e ){
        System.out.println( "option 1  failed." );
        e.printStackTrace();
}
try{            //OPTION 2
        filename = "http://www.erols.com/quantime/earthApp/earth.jpg";
        loader = new TextureLoader( filename, this );
        ImageComponent2D tempImage = loader.getImage();
        System.out.println( "option 2 succeeded." );
        image = tempImage;
}catch( Exception e ){
        System.out.println( "option 2 failed" );
        e.printStackTrace();
}
try{            //OPTION 3
        url = new URL( "http://www.erols.com/quantime/earthApp/earth.jpg" );
        loader = new TextureLoader( url, this );
        ImageComponent2D tempImage = loader.getImage();
        System.out.println( "option 3 succeeded." );
        image = tempImage;
}catch( Exception e ){
        System.out.println( "option 3 failed" );
        e.printStackTrace();
}

===========================================================================
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