Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

Getting java.lang.NoSuchMethod error. Can you see why?

$
0
0

Most of this code was taken from a source online. Not trying to pass it off as my own. Just trying to make sure I can successfully load an OBJ file into processing before I begin work in Blender then Processing.

The code I have is below. I have loaded, through drag and drop, my own OBJ file and MTL files, both called Lancer. It is a very plain 3D cube. Any help much appreciated. Like I said, at the moment, I am just trying to load the OBJ shape into Processing.

import processing.opengl.*;
import saito.objloader.*;

// declare that we need a OBJModel and we'll be calling it "model"
OBJModel model;

float rotX;
float rotY;
PImage tex;
// these booleans will be used to turn on and off bits of the OBJModel
boolean bTexture = true;
boolean bStroke = false;
boolean bMaterial = false;

void setup()
{
    size(800, 800, P3D);

    // making an object called "model" that is a new instance of OBJModel
    model = new OBJModel(this,"Lancer.obj", "relative", POLYGON);

    // turning on the debug output (it's all the stuff that spews out in the black box down the bottom)
    model.enableDebug();
    model.translateToCenter();
    model.scale(.9);
    model.printModelInfo();
    noStroke();
}

void draw()
{
    background(255);
    lights();

    //this will do nothing until the model material is turned off
  //  fill(255,0,255);

    pushMatrix();
    translate(width/2, height/2, 0);
    rotateX(rotY);
    rotateY(rotX);
    model.draw();
    popMatrix();
}

void mouseDragged()
{
    rotX += (mouseX - pmouseX) * 0.01;
    rotY -= (mouseY - pmouseY) * 0.01;
}

I think the errors are longer than the code.

draw mode:      POLYGON
Loading this = Lancer.obj
Loading this = untitled.mtl
untitled.mtl does not exist or could not be read
java.lang.NullPointerException
    at saito.objloader.OBJModel.parseMTL(OBJModel.java:973)
    at saito.objloader.OBJModel.parseOBJ(OBJModel.java:813)
Could not find this file untitled.mtl
    at saito.objloader.OBJModel.load(OBJModel.java:577)
    at saito.objloader.OBJModel.<init>(OBJModel.java:124)
    at sketch_160121a.setup(sketch_160121a.java:40)
    at processing.core.PApplet.handleDraw(PApplet.java:2374)
    at processing.opengl.PSurfaceJOGL$DrawListener.display(PSurfaceJOGL.java:731)
    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:759)
    at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:81)
    at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:452)
    at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)
Obj Name:       Cube.001

V  Size:    8
Vt Size:    0
Vn Size:    6
G  Size:    1
S  Size:        1

objloader version 021
18 August 2010
http:// code.google.com/p/saitoobjloader/

OBJBoundingBox -    Getting the Bounding Box
java.lang.RuntimeException: java.lang.NoSuchMethodError: processing.core.PVector.add(Lprocessing/core/PVector;)V
    at processing.opengl.PSurfaceJOGL$2.run(PSurfaceJOGL.java:443)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoSuchMethodError: processing.core.PVector.add(Lprocessing/core/PVector;)V
    at saito.objloader.BoundingBox.<init>(BoundingBox.java:46)
    at saito.objloader.OBJModel.translateToCenter(OBJModel.java:645)
    at sketch_160121a.setup(sketch_160121a.java:44)
    at processing.core.PApplet.handleDraw(PApplet.java:2374)
    at processing.opengl.PSurfaceJOGL$DrawListener.display(PSurfaceJOGL.java:731)
    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:759)
    at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:81)
    at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:452)
    at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)
Could not run the sketch (Target VM failed to initialize).
For more information, read revisions.txt and Help ? Troubleshooting.

I have a window open for the output too, but there is just a plain window, no box is displayed.

Thank you


Viewing all articles
Browse latest Browse all 2896

Trending Articles