Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
12-01-2012, 03:11 AM #1
- Join Date
- Dec 2012
- Thanked 0 Times in 0 Posts
Help in icosahedron file please help very urgent
can someone help me get this obj file working
This is the code called "Phong.java" that I am trying to run with the icosahedron object file.
I needed to use Phong.java and the teapot input to create a icosahedron
im unable to attach the object file here can someone email me at firstname.lastname@example.org and i will send the object file
its very urgent
please please please
here is the code, need help in fixing it
* An example for constructing an object (tetrahedron) with triangles
* where normal vectors are interpolated.
* @author Frank Klawonn
* Last change 05.07.2005
* @see GeomArrayExample
public class Isocahedran extends JFrame
//The canvas to be drawn upon.
public Canvas3D myCanvas3D;
//Mechanism for closing the window and ending the program.
//Default settings for the viewer parameters.
myCanvas3D = new Canvas3D(SimpleUniverse.getPreferredConfiguration());
//Construct the SimpleUniverse:
//First generate it using the Canvas.
SimpleUniverse simpUniv = new SimpleUniverse(myCanvas3D);
//Default position of the viewer.
//The scene is generated in this method.
//Add some light to the scene.
//The following three lines enable navigation through the scene using the mouse.
OrbitBehavior ob = new OrbitBehavior(myCanvas3D);
ob.setSchedulingBounds(new BoundingSphere(new Point3d(0.0,0.0,0.0),Double.MAX_VALUE));
//Show the canvas/window.
setTitle("An object loaded from a file");
public static void main(String args)
Isocahedran nfga = new Isocahedran();
//In this method, the objects for the scene are generated and added to
public void createSceneGraph(SimpleUniverse su)
//Load an obj-file.
ObjectFile f = new ObjectFile(ObjectFile.RESIZE);
Scene s = null;
s = f.load("isocahedron.obj");
catch (Exception e)
System.out.println("File loading failed:" + e);
//Generate a transformation group for the loaded object.
Transform3D tfObject = new Transform3D();
Transform3D xRotation = new Transform3D();
TransformGroup tgObject = new TransformGroup(tfObject);
Appearance yellowApp = new Appearance();
BranchGroup theScene = new BranchGroup();
//Add the tetrahedron to the scene.
Background bg = new Background(new Color3f(1.0f,1.0f,1.0f));
BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0),Double.MAX_VALUE);
//Add everything to the universe.
* Generates a default surface (Appearance) in a specified colour.
* @param app The Appearance for the surface.
* @param col The colour.
public static void setToMyDefaultAppearance(Appearance app, Color3f col)
//Some light is added to the scene here.
public void addLight(SimpleUniverse su)
BranchGroup bgLight = new BranchGroup();
BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
Color3f lightColour1 = new Color3f(1.0f,1.0f,1.0f);
Vector3f lightDir1 = new Vector3f(-1.0f,0.0f,-0.5f);
DirectionalLight light1 = new DirectionalLight(lightColour1, lightDir1);
Vector3f lightDir2 = new Vector3f(1.0f,0.0f,0.5f);
DirectionalLight light2 = new DirectionalLight(lightColour1, lightDir2);