The state is quite the same i checked it many time.
I am loading the textures using this method:
public void loadTexture(int i)
{
BufferedImage buff=null;
int[] img = null;
try{
buff=ImageIO.read(new BufferedInputStream(this.getClass().getResourceAsStream(theurl[i].toString())));
}catch(IOException ioex){System.out.println(ioex.toString());}
Raster r = buff.getRaster();
img = r.getPixels(0, 0, buff.getWidth(), buff.getHeight(), img);
texture = ByteBuffer.allocateDirect(buff.getWidth() * buff.getHeight() * 3);
for (int y = 0; y < buff.getHeight(); y++)
for (int x = 0; x < buff.getWidth(); x++)
{
texture.put((byte) img[(y * buff.getWidth() + x) * 3]);
texture.put((byte) img[(y * buff.getWidth() + x) * 3 + 1]);
texture.put((byte) img[(y * buff.getWidth() + x) * 3 + 2]);
}
tWidth = buff.getWidth();
tHeight = buff.getHeight();
}
when using the appletviewer in the command line from a machine that is on the same network as the server where the applet is it works.
If i use it from a machine outside the network i got this error trace:
javax.imageio.IIOException: Invalid JPEG file structure: two SOI markers
java.lang.NullPointerException
at JoGLtest.loadTexture(JoGLtest.java:402)
at JoGLtest.init(JoGLtest.java:207)
at net.java.games.jogl.impl.GLDrawableHelper.init(GLDrawableHelper.java:68)
at net.java.games.jogl.GLCanvas$InitAction.run(GLCanvas.java:214)
at net.java.games.jogl.impl.windows.WindowsGLContext.makeCurrent(WindowsGLC ontext.java:162)
at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.makeCurrent(Wi ndowsOnscreenGLContext.java:110)
at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:250)
at net.java.games.jogl.GLCanvas.reshape(GLCanvas.java:112)
at java.awt.Component.setBounds(Component.java:1664)
at java.awt.Component.resize(Component.java:1601)
at java.awt.Component.setSize(Component.java:1593)
at java.awt.FlowLayout.layoutContainer(FlowLayout.java:438)
at java.awt.Container.layout(Container.java:1020)
at java.awt.Container.doLayout(Container.java:1010)
at java.awt.Container.validateTree(Container.java:1092)
at java.awt.Container.validateTree(Container.java:1099)
at java.awt.Container.validateTree(Container.java:1099)
at java.awt.Container.validateTree(Container.java:1099)
at java.awt.Container.validateTree(Container.java:1099)
at java.awt.Container.validateTree(Container.java:1099)
at java.awt.Container.validate(Container.java:1067)
at sun.applet.AppletPanel.run(AppletPanel.java:365)
at java.lang.Thread.run(Thread.java:534)
If i use png images instead the error message will be “wrong PNG file”.
When using Internet explorer i have the following behaviour:
The first time i load the page from one computer it works, if i try another time it freezes even if i clean the cached files of JRE.
With Mozilla it freezes directly.
In conclusion it seems it is related to the imageIO or to the argument it is receiving. I am getting crazy trying making this works and i really need it works online. :-[
It would be wonderful if someone can take a look to what could be the source of this problem.