Models not loading after exporting

Started by ForOhFor Error, May 12, 2013, 07:01:33 PM

Previous topic - Next topic

ForOhFor Error

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.

Thomas.

#1
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).
Resources res = getResources();
tabletop = Object3D.mergeAll(Loader.loadOBJ(res.openRawResource(R.raw.tableTopObj),res.openRawResource(R.raw.tableTopMtl),260f));

ForOhFor Error

Resources doesn't appear to be a type I can import.

Thomas.

You have to call method getResources() in class which extends Activity.

kkl

#4
Or, you may do this


InputStream is = context.getAssets().open("greenleaf_02.3ds");
Loader.load3DS(is, scale);


Put the 3ds/obj file in assets folder.

Works for me.