Thanks. I was lost. Now, I'm having another problem, the sketch runs, but not with the object. I'm trying to load a rock into my sketch, just as a test. Here is my code:
-
import javax.media.opengl.*;
import processing.opengl.*;
import objimp.*;float aspectRatio =1;ObjImpScene rock;
int angle=0;
int radius = 100;
int evX=width/2;
int exY=height/2;
void setup() {
size (770, 770, OPENGL);
smooth();
try
{
rock = new ObjImpScene( this );
rock.load(dataPath("rock.obj"), 5 );
}
catch( Exception e )
{
println( e );
System.exit( 0 );
}
}
void draw() {
background(0);
noCursor();
// get x and y
float x = cos(radians(angle)) * radius;
float y = sin(radians(angle)) * radius;
camera(width/2, height/2, 0, 0, 0, 0, 0.0, 0.0, 1.0);
fill(234, 2, 2);
stroke(234, 2, 2);
strokeWeight(5);
point (width/2 + x, height/2 + y);
angle = mouseX/2;
stroke(0, 0, 0);
strokeWeight(1);
translate(width/2+x, height/2+y, 0);
box(10);
Here is the error it gives in the "Console"
Don't know what it's actually called.
java.lang.NullPointerException
at com.obj.parser.obj.MaterialParser.incoporateResults(MaterialParser.java:19)
at com.obj.WavefrontObject.parseLine(WavefrontObject.java:179)
at com.obj.WavefrontObject.parse(WavefrontObject.java:148)
at com.obj.WavefrontObject.<init>(WavefrontObject.java:88)
at com.obj.WavefrontObject.<init>(WavefrontObject.java:54)
at objimp.ObjImpScene.load(ObjImpScene.java:84)
Error, could not load obj:C:\Users\<removed>\Desktop\Sketches\firstpersongame2\data\rock.obj
at objimp.ObjImpScene.load(ObjImpScene.java:78)
at firstpersongame2.setup(firstpersongame2.java:48)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:662)
Currently the "firstpersongame2" folder has:
firstpersongame2.pde
data
rock.mtl
rock.obj