I have tried to display a line with the code under, but no line appears in
the applet. Simple solutions/tips available?

Thanks
Todda


import com.interaction.i3d.*;
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.event.*;
import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.universe.*;
import com.sun.j3d.utils.geometry.*;
import javax.media.j3d.*;
import javax.vecmath.*;
import com.sun.j3d.utils.behaviors.vp.*;
import java.awt.*;
import java.awt.Component;
import java.util.Enumeration;

public class Linje extends Applet {

  public Linje() {

    setLayout(new BorderLayout());

    Canvas3D canvas3D = new Canvas3D(null);
    add("Center", canvas3D);

    SimpleUniverse simpleU = new SimpleUniverse(canvas3D);
    simpleU.getViewingPlatform().setNominalViewingTransform();

    OrbitBehavior behavior = new OrbitBehavior (canvas3D,
OrbitBehavior.REVERSE_ALL);
    behavior.setSchedulingBounds(new BoundingSphere(new
Point3d(0,0,0),10.0));
    simpleU.getViewingPlatform().setViewPlatformBehavior (behavior);

    BranchGroup scene = createSceneGraph();
    scene.compile();

  }

    public BranchGroup createSceneGraph(){

      BranchGroup aRouteBG = new BranchGroup();

      LineArray geom = new LineArray(2,
                        GeometryArray.COORDINATES | GeometryArray.COLOR_3);

      Point3f point1 = new Point3f(-1f, -1f, -1f);
      Point3f point2 = new Point3f(1f, 1f, 1f);
      geom.setCoordinate(0, point1);
      geom.setCoordinate(1, point2);



      //Appearance
      Appearance lineApper = new Appearance();


      lineApper.setLineAttributes (new LineAttributes (2.0f,
LineAttributes.PATTERN_SOLID, false));

      //Color
      Color3f lineColor = new Color3f(0.7f, 0.7f, 0.7f);
      ColoringAttributes lineCA = new ColoringAttributes();
      lineCA.setColor(lineColor);
      lineApper.setColoringAttributes(lineCA);


      Shape3D lineShape = new Shape3D(geom,lineApper);
      aRouteBG.addChild(lineShape);

      return aRouteBG;
  }



  public static void main(String[] args){
   Frame frame = new MainFrame(new Linje(), 512, 512);
   }
}


_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

===========================================================================
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".

Reply via email to