Reputation: 969
I was trying to visualize a simple 3D model of the cylinder on the browser by importing OBJ file in three.js. I started with running simple example of three.js's OBJ loader:
https://github.com/mrdoob/three.js/blob/master/examples/webgl_loader_obj.html
which works fine locally.
I tried just by replacing the path of OBJ file with that of mine, but it failed to load. I double check the Path and it is correct.
On checking errors on the console on Firefox (Crtl + Shift + k)
, it says: Syntax Error
and throws following error:
[22:59:30.865] Error: WebGL: DrawElements: bound vertex attribute buffers do not have sufficient size for given indices from the bound element array @ http://localhost/~harmanpreet/three.js/build/three.min.js:455
The OBJ file is converted from model made in BRL-CAD (.g to .obj conversion). Link to OBJ file: http://devplace.in/~harman/cyl1_bot_dump.obj
Can anybody figure out what is the problem?
Thank you
Upvotes: 4
Views: 15492
Reputation: 1258
Your .obj file looks correct according to specs, but I would advise you to use a non-minified three.js version and then look at the code surrounding the error message.
Also what you could try is replacing the "g" in the obj file at start with an "o" (g = group, o = object) - I'm not sure how three.js handles this internally or if it makes a difference, but I guess it won't hurt to try.
Other than that the error seems to be saying something like "I encountered an array index which is out of bounds", meaning a face (f in the .obj file) uses an index which is higher than the highest defined index, but that doesn't seem to be the case with your file (.obj indexes start at 1, so everything should be fine).
Upvotes: 0