Obj Models not loading after exporting

Started by ForOhFor Error, May 13, 2013, 02:57:58 AM

Previous topic - Next topic

ForOhFor Error

(Posted this in the wrong section at first - whoops)

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.

EgonOlsen

To load files from a jar, access them via an InputStream like so:


getClass().getClassLoader().getResourceAsStream("res/model/Tabletop.obj");

ForOhFor Error

And that's for loading files that are contained in the jar, correct?

EgonOlsen


ForOhFor Error

Same result :/
Just a blank, blue screen (I can blit onto it, so the buffer is rendering fine).
And it works perfectly in eclipse :/

EgonOlsen

Then your path to the resources is wrong. If they sit in your jar in a directory "res/model", use "/res/model/Tabletop.obj". This isn't related to jPCT at all, you should be able to find examples for this all over the internet.

ForOhFor Error