problem loading wrl file with sun vrml97 loader
Hi, I have written a program to load wrl files. The program runs well when I load the HelloWorld.wrl file to test the program but, when I try to load other file I can't see nothing (I think that the file is ok, because I can see the 3D image with other browsers).
I can see something (white figure) when I set the appearance of the Shape3D objects to the default appearance through this method (posted in the forum):
void traverse(java.util.Enumeration en){
while(en.hasMoreElements()){
Object obj = en.nextElement();
if( objinstanceof Shape3D ){
Shape3D shape3D = (Shape3D) obj;
shape3D.setAppearance(new Appearance() );
}
if( objinstanceof Group ){
Group group = (Group) obj;
traverse( group.getAllChildren() );
}
}// end while
}
I tried to put an ambient light, but the result was the same (black universe). Here is the code:
publicvoid load(File file){
BranchGroup bg =new BranchGroup();
VrmlLoader loader =new VrmlLoader();
Scene scene =null;
try{
scene = loader.load(file.getName());
}catch(Exception e){
System.err.println( e.toString() );
return;
}
// traverse( scene.getSceneGroup().getAllChildren() );
bg.addChild( scene.getSceneGroup() );
AmbientLight light =new AmbientLight(
true,new Color3f(1.0f,1.0f,1.0f)
);
BoundingSphere bounds =new BoundingSphere(
new Point3d(0.0,0.0,0.0),100.0
);
light.setInfluencingBounds(bounds);
bg.addChild(light);
universe.addBranchGraph( bg );
}
I don't know how can I see the figure without setting the appearance of the figure. Any suggestion?
Thanks in advance and sorry for my primitive english

