I'm trying to load an OBJ model with Three.js.
At first I tried this:
var loader = new THREE.OBJLoader( );
loader.load( 'chair.obj', function ( object )
{
scene.add( object );
});
But I got an error saying that cross origin request are only supported in HTTP.
I looked on the internet for help, found this page: https://github.com/mrdoob/three.js/wiki/How-to-run-things-locally
and tried to run Chrome from cmd line: chrome --allow-file-access-from-files
Still nothing.
Finally I tried using Python's built in Http server. and tried loading like this:
var loader = new THREE.OBJLoader( );
loader.load( 'http://localhost:8000/chair.obj', function ( object )
{
scene.add( object );
});
Now the scene loads but the model that I tried to load does not show up. In Chrome Dev tools, I see the following error:
XMLHTTPRequest Could not load.Origin null is not allowed by Access-Control-Allow-Origin.
I have expertise with 3D graphics on the desktop, but I am completely new to JavaScript and internet technology. I'm really excited by Three.js and am really motivated to explore it but I have these kinds of hiccups getting set.
I've tried to look this up on the internet but have not succeeded. I really need help. I'd appreciate any pointers anyone might have on how to get past this.
Thanks