|
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
|
- [JAVA3D] Texture loading problem for big files ... hammad
- Re: [JAVA3D] Texture loading problem for big fil... Vladimir Vernikovski
- Re: [JAVA3D] Texture loading problem for big fil... Martin Frey
- Re: [JAVA3D] Texture loading problem for big fil... Alessandro Borges
- Re: [JAVA3D] Texture loading problem for big... Lan Wu-Cavener
- Re: [JAVA3D] Texture loading problem for... Alessandro Borges
- Re: [JAVA3D] Texture loading problem for big fil... Alessandro Borges
- Re: [JAVA3D] Texture loading problem for big fil... Yazel, David J.
- Re: [JAVA3D] Texture loading problem for big fil... Lan Wu-Cavener
