Author Topic: Can't load any meshes  (Read 4713 times)

Offline BlindSide

  • byte
  • *
  • Posts: 4
    • View Profile
Can't load any meshes
« on: August 19, 2007, 11:37:49 am »
Hey guys I can't load any 3DS or MD2 meshes. I have tried different meshes and also some from the examples (So that I know it is not the meshes fault.)

Here is the code I am using to load them:
myPlayer = Loader.load3DS("mesh.3ds",1);
or
myPlayer = Loader.loadMD2("mesh.md2",1);

And I always get the error:
Loading file mesh.3ds
[ Sun Aug 19 21:34:09 NZST 2007 ] - ERROR: Couldn't read file mesh.3ds
[ Sun Aug 19 21:34:09 NZST 2007 ] - ERROR: Not a valid 3DS file!
java.lang.ArrayIndexOutOfBoundsException: 0
   at Main.init(Main.java:31)
   at sun.applet.AppletPanel.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)

No matter where I place the file I get the error, (Same directory as applet, inside jar archive, etc...).

Can anyone tell me what I am doing wrong here? Oh yeah I am using an applet as I just mentioned haha... Does it need to be signed or something to load external resources? I am only using software renderer.

I also can't load any jpg files it says that there are no security permissions (Even if I use a normal file from the examples, it is not read only or anything weird like that, and I am administrator).

Cheers  ;)

Offline BlindSide

  • byte
  • *
  • Posts: 4
    • View Profile
Re: Can't load any meshes
« Reply #1 on: August 19, 2007, 11:51:16 am »
Nevermind, I got it working. I used an input stream and placed the file inside the jar archive.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12297
    • View Profile
    • http://www.jpct.net
Re: Can't load any meshes
« Reply #2 on: August 19, 2007, 05:28:34 pm »
Either use the InputStream solution or use the methods that are explicitly there for applets (the ones with an additional document base url). The normal methods assume the files to exist in the current (or given) directory. I'm not sure what that is in case of an applet, but for sure not the external resource on the server.

Offline BlindSide

  • byte
  • *
  • Posts: 4
    • View Profile
Re: Can't load any meshes
« Reply #3 on: August 20, 2007, 01:48:27 pm »
The error was slightly misleading though. Is it possible to change it to something similar to "File not found"? The current error gave me the impression that the particular mesh was corrupted or unsupported somehow.

Cheers

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12297
    • View Profile
    • http://www.jpct.net
Re: Can't load any meshes
« Reply #4 on: August 20, 2007, 02:30:21 pm »
The error you got is just a consequence of the former one. Just set the Logger so that it throws exceptions in case of errors instead of resuming, and you'll get a more cleaner error handling.

Offline BlindSide

  • byte
  • *
  • Posts: 4
    • View Profile
Re: Can't load any meshes
« Reply #5 on: August 23, 2007, 02:06:59 pm »
Thx, C++ has made me too naive ... or paranoid, HEY! Whos that in my car!!?!?  >:(  :P