Author Topic: Models not loading after exporting  (Read 2092 times)

Offline ForOhFor Error

  • byte
  • *
  • Posts: 10
    • View Profile
Models not loading after exporting
« on: May 12, 2013, 07:01:33 pm »
So, my problem is fairly simple. I have a call to load a model in my project:
tabletop = Object3D.mergeAll(Loader.loadOBJ("res/model/Tabletop.obj","res/model/Tabletop",260f));
and all is well in eclipse - it loads just fine.

However, when I export the jar (and package it all up with JarSplice), the model doesn't load (none of the models I'm using load, in fact).

I have tried placing the res folder in both the jar itself, and in a folder alongside the jar, and both just load with a blank buffer being rendered.

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Models not loading after exporting
« Reply #1 on: May 12, 2013, 07:18:16 pm »
You can not do that this way. Replace your code by this one. Names of files can not be the same (regardless of the file extension).
Code: [Select]
Resources res = getResources();
tabletop = Object3D.mergeAll(Loader.loadOBJ(res.openRawResource(R.raw.tableTopObj),res.openRawResource(R.raw.tableTopMtl),260f));
« Last Edit: May 12, 2013, 07:29:14 pm by Thomas. »

Offline ForOhFor Error

  • byte
  • *
  • Posts: 10
    • View Profile
Re: Models not loading after exporting
« Reply #2 on: May 12, 2013, 07:25:15 pm »
Resources doesn't appear to be a type I can import.

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Models not loading after exporting
« Reply #3 on: May 12, 2013, 07:28:40 pm »
You have to call method getResources() in class which extends Activity.

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Re: Models not loading after exporting
« Reply #4 on: May 28, 2013, 04:54:14 am »
Or, you may do this

Code: [Select]
InputStream is = context.getAssets().open("greenleaf_02.3ds");
Loader.load3DS(is, scale);

Put the 3ds/obj file in assets folder.

Works for me.
« Last Edit: May 28, 2013, 06:27:59 am by kkl »