I am a new libgdx programmer. I am developing on Android and i found some materials about libgdx。 Such as Xoppa blog, I see he write code to load model, e.x: public AssetManager asset;
asset = new AssetManager();
asset.load("xxx.obj",Model.class);
Model model = asset.get("xxx.obj",Model.class);
..... it can correct load model to display.
But I used this code to load other obj file, such as room.obj by 3dMax, it can't correct display...why? the code is the same, only difference is file's name....can anyone tell me?or help me, thank you.
First in OnCreate method:
assets = new AssetManager();
assets.load("data/yellow_note.obj", Model.class);
loading = true;
add this method:
private void doneLoading() {
Model ship = assets.get("data/yellow_note.obj", Model.class);
//Here you add a model to you Array of Model Instance to render
ModelInstance shipInstance = new ModelInstance(ship);
instances.add(shipInstance);
loading = false;
}
now in method OnRender:
if (loading && assets.update())
doneLoading();
I find this solution here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With