I'm a beginner. I know nothing more than I read in some tutorials. So
pelase be patient and forgiving ;-)
So when I try to construct the scene, the only thing I see is black and
probably empty area :( My code is similiar to what I've seen in those
tutorials but it simply isn't working, while the examples I tried gave
good results. This is code of my createScene function:
meshX and meshY are constants. int intensity[][] keeps values of y
coordinates. These values can generally be anything between 1 and 255.
public BranchGroup createScene()
{
TransformGroup tg = new TransformGroup();
BranchGroup objRoot = new BranchGroup();
TriangleArray tri;
for(i=0;i<meshX-1;i++)
for(j=0;j<meshY-1;j++)
{
tri = new TriangleArray(3, TriangleArray.COORDINATES);
Shape3D shape = new Shape3D();
tri.setCoordinate(0, new Point3f(i+1, intensity[i+1][j], j));
tri.setCoordinate(1, new Point3f(i, intensity[i][j], j));
tri.setCoordinate(2, new Point3f(i, intensity[i][j+1], j+1));
shape.setGeometry(tri);
tg.addChild(shape);
Shape3D shape2 = new Shape3D();
tri = new TriangleArray(3, TriangleArray.COORDINATES);
tri.setCoordinate(0, new Point3f(i+1, intensity[i+1][j+1],
j+1));
tri.setCoordinate(1, new Point3f(i+1, intensity[i+1][j], j));
tri.setCoordinate(2, new Point3f(i, intensity[i][j+1], j+1));
shape2.setGeometry(tri);
tg.addChild(shape2);
}
Transform3D cc3d = new Transform3D();
cc3d.setTranslation(new Vector3f (0f ,0f ,10f ));
tg.setTransform(cc3d);
objRoot.addChild(tg);
return objRoot;
}
can you help me?
Marcin
mike.jacobs@indietechnologies.com - 05 Jan 2006 21:11 GMT
Marcin, Check out this article for examples
(http://jdj.sys-con.com/read/46231.htm). I notice that your code does
not include the full scene graph. Be sure you have at least an ambient
light added to see your scene.