OBJ Loader .obj ArrayIndexOutOfBoundsException: 2 load problem
in
Contributed Library Questions
•
2 years ago
Hi,
I'm currently trying to import a very simple .obj file created in maya.
It's a simple cylinder without any texture.
When i try to run the following code :
It seems that the error is thrown by the line :
Here's the .obj file.
Many Thanks.
I'm currently trying to import a very simple .obj file created in maya.
It's a simple cylinder without any texture.
When i try to run the following code :
- import processing.opengl.*;
- import saito.objloader.*;
-
- OBJModel model3D1;
- float rotX, rotY, zoom;
-
- void setup() {
- size(400, 200, P3D);
-
- addMouseWheelListener(new java.awt.event.MouseWheelListener() {
- public void mouseWheelMoved(java.awt.event.MouseWheelEvent evt) {
- mouseWheel(evt.getWheelRotation());
- }
- }
- );
-
- model3D1 = new OBJModel(this, "cylindre.obj");
- model3D1.disableTexture();
- model3D1.scale(80);
- model3D1.translateToCenter();
- model3D1.disableDebug();
- stroke(0);
- noStroke();
- noFill();
- zoom=1;
- }
-
- void draw() {
- background(255);
- lights();
- pushMatrix();
- translate(width/2, height/2, 0);
- rotateX(rotY);
- rotateY(rotX);
- scale(zoom);
- model3D1.draw();
- popMatrix();
- }
-
- void mouseDragged() {
- rotX += (mouseX - pmouseX) * 0.01;
- rotY -= (mouseY - pmouseY) * 0.01;
- }
-
- void mouseWheel(int delta) {
- if (delta<0) {
- zoom-=0.1;
- }
- else {
- zoom+=0.1;
- }
- }
java.lang.ArrayIndexOutOfBoundsException: 2
at saito.objloader.OBJModel.parseOBJ(OBJModel.java:864)
at saito.objloader.OBJModel.load(OBJModel.java:577)
at saito.objloader.OBJModel.<init>(OBJModel.java:86)
at Cylinder3D.setup(Cylinder3D.java:41)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)
It seems that the error is thrown by the line :
- model3D1 = new OBJModel(this, "cylindre.obj");
Here's the .obj file.
Many Thanks.
1