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 › Object loader/draw problem
Page Index Toggle Pages: 1
Object loader/draw problem (Read 742 times)
Object loader/draw problem
Mar 5th, 2006, 7:30pm
 
Hi there,

I'm trying to use my 3D objects exported from Lightwave 7.0 in Processing - but it doesnt work.. Do the files need any special settings? The *.obj is loaded, but drawing doesnt work - does anybody have an idea why this can happen? I tried also very simple objects with only few polygons..

In the sample I found somewhere here is also a material file in the data folder. As Lightwave didnt generate any relating *.mtl file I tried to use the one from the sample by renaming it and copiing into my data folder - without success..

Processing complains:
__________________________________________________________
model loaded

java.lang.NullPointerException
at saito.objloader.OBJModel.drawModel(OBJModel.java:151)
__________________________________________________________
susanne
Re: Object loader/draw problem
Reply #1 - Mar 6th, 2006, 11:07am
 
You'll probably need to post your code. Null pointer means a pointer (variable or something) is empty.
Re: Object loader/draw problem
Reply #2 - Mar 6th, 2006, 2:48pm
 
It's just the basic stuff. I took the sample from saito object loader, (which is working) and replaced the included object with mine. It looks if it were a format - problem. We tried to to it with various *.obf - files exported from different 3D - applications - all of them didnt work - except one exported from 3D Max.


//import processing.opengl.*;

// .OBJ Loader
// by SAITO <http://users.design.ucla.edu/~tatsuyas>
// Placing a virtual structure represented as mathematically
// three-dimensional object.
// SModel.load() reads structure data of the object stored
// as numerical data.
// SModel.draw() gives a visual form to the structure data.
// processing standard drawing functions can be used to manipulate
// the visual form to create deep visual experiences.
// Created 20 April 2005

import saito.objloader.*;

OBJModel model;
float rotX;
float rotY;

void setup()
{
 size(600, 600, P3D);
 framerate(30);
 model = new OBJModel(this);
 model.debugMode();
 model.load("susanne.obj");
}
void draw()
{
 background(255);
 lights();
 pushMatrix();
 translate(width/2, height/2, 0);
 rotateX(rotY);
 rotateY(rotX);
 scale(30.0);
 model.draw();
 popMatrix();
}

Re: Object loader/draw problem
Reply #3 - Mar 6th, 2006, 4:12pm
 
That'll be it then, yeah.

Years ago I wrote a thing in php/flash which imported .obj files and if I remember right they were just text based, and pretty simple. just a list of verts with coordinate positions.

If they're still text based, maybe you could look through and compare one to a max-native one and find whatever differences are causing the importer to choke. And then either ammend the obj files or improve the importer.
Page Index Toggle Pages: 1