We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › OBJloader and objimport
Page Index Toggle Pages: 1
OBJloader and objimport (Read 1614 times)
OBJloader and objimport
Feb 24th, 2010, 8:07am
 
Hi  :)

I've been trying to load an .obj using the objloader library. The object is rendered but lots of polygons are missing. I tried all the drawMode (polygon, quads, triangle) and polygons works best but still not well enough. Is there a solution for this? Does it happen often?

I've also tried the objimport library; so far I haven't been able to get it to work, even though I'm using one of the examples included in the library package. I get NullPointerException. Here's the code, perhaps somebody can tell me why... thanks

import objimp.*;
import utils.*;
import com.obj.parser.mtl.*;
import com.obj.parser.obj.*;
import com.obj.parser.*;
import com.obj.*;

import javax.media.opengl.*;
import processing.opengl.*;


float aspectRatio = 1;

ObjImpScene scene2;


void setup()
{
 size( 800, 600, OPENGL );

 aspectRatio = width / (float)height;

 frameRate( 60 );

 scene2 = new ObjImpScene( this );
 scene2.load( "test2_obj.obj", 5 );
}

void draw()
{
 float time = millis() * 0.001;

 background( 0.4*255 );
 perspective( PI*.25, aspectRatio, 1, 1000 );
 camera( 0, 3, 0, -2*cos(time*.5), sin(time)*2+3, -2*sin(time*.5), 0, 1, 0 );
lights();
 scale( 1, -1, 1 );

 
//  translate( 0, -10, 0 );
 rotateY( radians(mouseX) );
 
 scene2.draw();  
}


Re: OBJloader and objimport
Reply #1 - Feb 24th, 2010, 11:06pm
 
hmm, that error does not help much. give me more details on the crash for objimport and if possible, send me your obj file. i would like to test it on my own if possible.
Re: OBJloader and objimport
Reply #2 - Feb 26th, 2010, 8:07am
 
thanks for answering.
I don't know what else to say about the crush, except that it won't load the object. here's the full error message

java.lang.ArrayIndexOutOfBoundsException: 3
     at com.obj.parser.obj.FaceParser.parseLine(FaceParser.java:75)
     at com.obj.parser.obj.FaceParser.parseQuad(FaceParser.java:91)
     at com.obj.parser.obj.FaceParser.parse(FaceParser.java:35)
     at com.obj.WavefrontObject.parseLine(WavefrontObject.java:178)
     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)
     at objimp.ObjImpScene.load(ObjImpScene.java:78)
     at angoisse_objimport.setup(angoisse_objimport.java:54)
     at processing.core.PApplet.handleDraw(PApplet.java:1402)
     at processing.core.PApplet.run(PApplet.java:1327)

Error, could not load obj:/ANGOISSE/Processing/angoisse_objimport/data/test_obj.obj
     at java.lang.Thread.run(Thread.java:613)

Exception in thread "Animation Thread" java.lang.NullPointerException
     at objimp.ObjImpScene.load(ObjImpScene.java:95)
     at objimp.ObjImpScene.load(ObjImpScene.java:78)
     at angoisse_objimport.setup(angoisse_objimport.java:54)
     at processing.core.PApplet.handleDraw(PApplet.java:1402)
     at processing.core.PApplet.run(PApplet.java:1327)
     at java.lang.Thread.run(Thread.java:613)

I'm sending you the object file directly to your email adress

Carola
Re: OBJloader and objimport
Reply #3 - Feb 26th, 2010, 1:32pm
 
ok, i'll wait for your file and then give you some more feedback.
Page Index Toggle Pages: 1