www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: ForOhFor Error on May 12, 2013, 07:01:33 pm

Title: Models not loading after exporting
Post by: ForOhFor Error 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.
Title: Re: Models not loading after exporting
Post by: Thomas. 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));
Title: Re: Models not loading after exporting
Post by: ForOhFor Error on May 12, 2013, 07:25:15 pm
Resources doesn't appear to be a type I can import.
Title: Re: Models not loading after exporting
Post by: Thomas. on May 12, 2013, 07:28:40 pm
You have to call method getResources() in class which extends Activity.
Title: Re: Models not loading after exporting
Post by: kkl 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.