I'm trying to import a 3D model of a space shuttle but processing is giving me a really hard time doing this for some reason. I watched examples and even opened the .OBJ file on ym computer and it renders nicely but processing doesn't want to open it. The code snippet is really simple as shown below:
PShape rocket;
int windowSize = 1000; // size of square window
void setup() {
size(1000, 1000, P3D);
rocket = loadShape("space-shuttle.obj");
}
void draw() {
background(100);
shape(rocket);
}
I made sure I added the file to the data folder and also tried with a .svg in 2D which worked but I need the 3D model for my project. The error that I get is below. Any help would be appreciated! I am using processing 4.0. I had also tried with earlier versions but nothing happened
The file "space-shuttle.obj" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
java.lang.NullPointerException: Cannot invoke "java.io.BufferedReader.readLine()" because "reader" is null
at processing.core.PShapeOBJ.parseOBJ(PShapeOBJ.java:168)
at processing.core.PShapeOBJ.<init>(PShapeOBJ.java:40)
at processing.core.PShapeOBJ.<init>(PShapeOBJ.java:27)
at processing.opengl.PGraphics3D.loadShapeImpl(PGraphics3D.java:128)
at processing.opengl.PGraphicsOpenGL.loadShape(PGraphicsOpenGL.java:3382)
at processing.core.PApplet.loadShape(PApplet.java:11254)
at simulation.setup(simulation.java:30)
at processing.core.PApplet.handleDraw(PApplet.java:2142)
at processing.opengl.PSurfaceJOGL$DrawListener.display(PSurfaceJOGL.java:825)
at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:692)
at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:674)
at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:443)
at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293)
at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147)
at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:782)
at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:81)
at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:453)
at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178)
at java.base/java.util.TimerThread.mainLoop(Timer.java:566)
at java.base/java.util.TimerThread.run(Timer.java:516)
