Hi,
Measure your textures by pixel size, not in MB size...
GForce4 Ti can handle textures up to 4096x4096 pixels. 
GForce4 MX can handle textures up to 2048x2048 pixels. 
Greater sizes will not work properly. 
 
You can try the below code.  This method doesnot work with applets, but you can modifie it to do that.
I did not bench, but I guess you  will ;-) 
Usage example:
 
Texture tex = fastLoadJPGTextures("stone.jpg", Texture.BASE_LEVEL, Texture.RGB, 0);
 
 

/************ BEGIN CODE  *******************/
/*
*  Try to load JPG textures faster than LoadTexture by using com.sun.image.codec.jpg.*;
*/
 public Texture2D fastLoadJPGTextures(String path, int mipMapmode, int format, int level)
   {
     java.awt.image.BufferedImage bImage=null;
     ImageComponent2D buffer = null;
     java.io.FileInputStream fis = null;
     java.io.BufferedInputStream bis = null;
 
        System.out.println("Loading texture");
       try
    {
      fis = new java.io.FileInputStream(path);
      bis = new java.io.BufferedInputStream(fis);
 
     com.sun.image.codec.jpeg.JPEGImageDecoder jie =
           com.sun.image.codec.jpeg.JPEGCodec.createJPEGDecoder(bis);
     bImage = jie.decodeAsBufferedImage();
 
     fis.close();
     }
     catch(java.io.FileNotFoundException fnf)
     {
       System.out.println("File " + path + " not found.");
       return null;
     }
     catch (java.io.IOException ioe)
     {
        System.out.println("Error while loading " + path);
        return null;
     }
     buffer = new ImageComponent2D(ImageComponent.FORMAT_RGB, bImage);
    
    Texture2D t2d = new Texture2D( mipMapmode, format, bImage.getWidth(), bImage.getHeight() );
     t2d.setImage(level,buffer);
    
      return t2d;
  }
 
/*********** END CODE ****************************************************/
 
I hope it helps
Alessandro
 
 
----- Original Message -----
From: hammad
Sent: Thursday, June 05, 2003 1:58 AM
Subject: [JAVA3D] Texture loading problem for big files ...

I am trying to load a map within my 3D Universe via TextureLoader utility.. The problem which i am facing is that is eats a hell lot of time ....
I have tried differenent file formats like gif, bmp and jpg ..... the.bmp files loads the fastest that is around 40 secs ... which is a 12MB file ....
 
Is there any more elegant way to load such huge files quicker ... I am P4 system with GForce4 3D card ... so processing is not an issue out here .. and the map is in the order of 2 so the loading should be efficent in that case as well
 
I am using it like this
Texture texture = new TextureLoader(mapPath,null).getTexture();
 
Any ideas ...
Hammad


Do you Yahoo!?
Free online calendar with sync to Outlook(TM).

Reply via email to