Open ClaudioPaterniti opened 4 years ago
I pasted the following into requirebin and it worked:
const OBJ = require('webgl-obj-loader');
// chaining promise approach
OBJ.downloadModels([{
obj: 'http://frenchtoast747.github.io/webgl-obj-loader/models/suzanne.obj',
mtl: true
}])
.then((data) => console.log("success:", data))
.catch((e) => console.error("Failure:", e));
// resolved/rejected in the same `.then()`
OBJ.downloadModels([{
obj: 'http://frenchtoast747.github.io/webgl-obj-loader/models/suzanne.obj',
mtl: true
}])
.then(
function(data) { console.log("success:", data) },
function(e) { console.error("Failure:", e) }
);
In the console:
I apologize, I'd link to a working snippet, but RequireBin is not letting me save the snippet at the moment.
I would expect you to see something in the console with the code you've pasted above. The only thing that looks odd to me is the URL model/test.obj
, you may want to use absolute paths instead.
I was using the minimized version webgl-obj-loader.min.js and could not make it work, I tried with the full version and it actually printed success with the same code I was using before. I don't know much about javascript but I guess there is something wrong with the minimization, maybe some name conflict.
Thanks for the details! I will look into this more.
I'm trying to use the downloadModels() function like this:
The files are actually successfully requested to the server but nothing is ever printed to the console. What am I doing wrong?