Hi Tor
I am sorry, but it was a typo error. The actual code should have been
geom.setColor(1, lineColor);
I think that should solve the problem!
Regds
Anand
Tor Einar Kj $B�S (Bkleiv <[EMAIL PROTECTED]> on 07/06/2001 11:26:58 AM
Please respond to Discussion list for Java 3D API <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc: (bcc: Anand PILLAI/dassault-systemes)
Subject: Re: [JAVA3D] Displaying a line...
Thanks Anand, Alvaro and aant!
I $B%( (Bve tried all suggested solutions but still no line will display itself on
the screen. I did not quite understand Anand what you ment by the line
"geom.setColor(1, setColor);". Is it possible for you to explain closer? And
I $B%( (Bm very happy for any new suggestions that will bring me closer to
displaying the line.
Todda
Here $B%( (Bs the code again:
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);
simpleU.getViewer().getView().setFrontClipDistance(0.1);
simpleU.getViewer().getView().setBackClipDistance(30);
BranchGroup scene = createSceneGraph();
scene.compile();
simpleU.addBranchGraph(scene);
}
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);
//Appearance
Appearance lineApper = new Appearance();
//LineAttrib
LineAttributes lineAttrib = new LineAttributes();
lineAttrib.setLineWidth(5);
lineApper.setLineAttributes(lineAttrib);
//Color
Color3f lineColor = new Color3f(0.5f, 0.5f, 0.5f);
ColoringAttributes lineCA = new ColoringAttributes();
lineCA.setColor(lineColor);
geom.setColor(0, lineColor);
//geom.setColor(1, setColor);
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".
===========================================================================
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".