Reading the Java3d Tutorial i notice that there is a recipe.
Now, i am trying to create a cube with the following coordinators
A {0,0,0}
B {0,0,1}
C {1,0,1}
D {1,0,0}
E {0,1,1}
F {1,1,1}
G {1,1,0}
H {0,1,0}
Here is my attempt
-----------------
import java.awt.*;
import javax.media.j3d.*;
import javax.vecmath.*;
import com.sun.j3d.utils.universe.*;
import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.geometry.*;
public class TheCube extends javax.media.j3d.Shape3D {
public TheCube() {
ViewingPlatform ourView;
setLayout(new BorderLayout());
GraphicsConfiguration config =
SimpleUniverse.getPreferredConfiguration();
Canvas3D c = new Canvas3D(config);
add("Center", c);
SimpleUniverse u = new SimpleUniverse(c);
BranchGroup scene = createSceneGraph();
u.addBranchGraph(scene);
ourView = u.getViewingPlatform();
ourView.setNominalViewingTransform();
BranchGroup objRoot = new BranchGroup();
Appearance app = new Appearance();
Point3d A=new Point3d(0,0,0);
Point3d B=new Point3d(0,0,1);
Point3d C=new Point3d(1,0,1);
Point3d D=new Point3d(1,0,0);
Point3d E=new Point3d(0,1,1);
Point3d F=new Point3d(1,1,1);
Point3d G=new Point3d(1,1,0);
Point3d H=new Point3d(0,1,0);
Point3d[] points =new Point3d[8];
int[] stripCounts= new int[4];
stripCounts[0]=4;
stripCounts[1]=4;
stripCounts[2]=4;
stripCounts[3]=4;
int[] contourCount=new int[4];
contourCount[0]=1;
contourCount[1]=1;
contourCount[2]=1;
contourCount[3]=1;
GeometryInfo gInf = new GeometryInfo(GeometryInfo.POLYGON_ARRAY);
gInf.setCoordinates(points);
gInf.setStripCounts(stripCounts);
gInf.setContourCounts(contourCount);
NormalGenerator ng= new NormalGenerator();
ng.generateNormals(gInf);
this.setGeometry(gInf.getGeometryArray());
}
public static void main(String[] args) {
new MainFrame(new TheCube(), 700, 700);}
}
---------------------
The Errors
-----------------
--------------------Configuration: j2sdk1.4.0 <Default>--------------------
D:\java\TheCube.java:16: cannot resolve symbol
symbol : method setLayout (java.awt.BorderLayout)
location: class TheCube
setLayout(new BorderLayout());
^
D:\java\TheCube.java:23: cannot resolve symbol
symbol : method add (java.lang.String,javax.media.j3d.Canvas3D)
location: class TheCube
add("Center", c);
^
D:\java\TheCube.java:27: cannot resolve symbol
symbol : method createSceneGraph ()
location: class TheCube
BranchGroup scene = createSceneGraph();
^
D:\java\TheCube.java:88: cannot resolve symbol
symbol : constructor MainFrame (TheCube,int,int)
location: class com.sun.j3d.utils.applet.MainFrame
new MainFrame(new TheCube(), 700, 700);}
^
4 errors
Process completed.
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".