Loading...
Logo
Processing Forum
I found this tutorial video and lib resp for importing .OBJ 3d files into processing environment through these


Then to start with I wrote the following code just to upload a simple 3d .OBJ file (made in  ble nder's mesh's icosphere )
                                                                                                                                      ( Add->mesh->icosphere.)
then I exported the file into .OBJ format as guided in the video. 

Th code is:

Copy code
  1. import processing.opengl.*;
  2. import saito.objloader.*;

  3. OBJModel model ;

  4. void setup()
  5. {
  6.     size(1000, 600, OPENGL);
  7.     //frameRate(30);
  8.     model = new OBJModel(this, "test3.obj");
  9.     //model.enableDebug();
  10.     model.scale(20);
  11.     model.translateToCenter();
  12.     noStroke();
  13. }

  14. void draw()
  15. {
  16.     background(129);
  17.     lights();
  18.     translate(width/2, height/2, 0);
  19.     model.draw();
  20. }
                    I just got a gray screen and nothing on it and following in the troubleshoot monitor of processing:

Copy code
  1. Loading this = test3.obj
  2. Loading this = test3.mtl
  3. java.lang.ArrayIndexOutOfBoundsException: 1
  4. at saito.objloader.OBJModel.parseMTL(OBJModel.java:993)
  5. at saito.objloader.OBJModel.parseOBJ(OBJModel.java:813)
  6. at saito.objloader.OBJModel.load(OBJModel.java:577)
  7. at saito.objloader.OBJModel.<init>(OBJModel.java:86)
  8. at obj_test.setup(obj_test.java:32)
  9. at processing.core.PApplet.handleDraw(Unknown Source)
  10. at processing.core.PApplet.run(Unknown Source)
  11. at java.lang.Thread.run(Thread.java:662)
  12. Obj Name: Icosphere

  13. java.lang.ArrayIndexOutOfBoundsException: 1
  14. at saito.objloader.OBJModel.parseOBJ(OBJModel.java:840)
  15. at saito.objloader.OBJModel.load(OBJModel.java:577)
  16. at saito.objloader.OBJModel.<init>(OBJModel.java:86)
  17. at obj_test.setup(obj_test.java:32)
  18. at processing.core.PApplet.handleDraw(Unknown Source)
  19. at processing.core.PApplet.run(Unknown Source)
  20. at java.lang.Thread.run(Thread.java:662)
  21. V  Size: 42
  22. Vt Size: 0
  23. Vn Size: 0
  24. G  Size: 1
  25. S  Size: 0

  26. OBJBoundingBox - Getting the Bounding Box
  27. .
In the video I noticed the guy mentioned about syncing the scaling as same in blender environment in the last few seconds as initially he was also facing the same trouble. 

I couldn't understand that. 

Please help.