www.jpct.net
jPCT-AE - a 3d engine for Android => Support => Topic started 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.
-
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));
-
Resources doesn't appear to be a type I can import.
-
You have to call method getResources() in class which extends Activity.
-
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.