Please see the below code, Nothing appears on the screen.
what is the problem?
public j3d(){
        c3d=new Canvas3D(SimpleUniverse.getPreferredConfiguration());
        su=new SimpleUniverse(c3d);
        bgRoot=new BranchGroup();
        execute();
    }
    public void execute(){
        add("Center",c3d);
        setSize(400,400);
        bgRoot=createSceneGraph();
        su.getViewingPlatform().setNominalViewingTransform();
        bgRoot.compile();
        su.addBranchGraph(bgRoot);
        show();
    }
public BranchGroup createSceneGraph(){
        BranchGroup bg1 = new BranchGroup();
        Appearance app = new Appearance();
        ColoringAttributes catt = new ColoringAttributes();
        catt.setColor(new Color3f(Color.blue));
        app.setColoringAttributes(catt);
        TriangleArray triangleArray=new TriangleArray(6,TriangleArray.COORDINATES|TriangleArray.COLOR_3);
        triangleArray.setCoordinate(0,new Point3f(0.0f,0.0f,0.0f));
        triangleArray.setCoordinate(1,new Point3f(2.0f,0.0f,0.0f));
        triangleArray.setCoordinate(2,new Point3f(0.0f,0.0f,2.0f));
        triangleArray.setCoordinate(3,new Point3f(0.0f,0.0f,2.0f));
        triangleArray.setCoordinate(4,new Point3f(2.0f,0.0f,0.0f));
        triangleArray.setCoordinate(5,new Point3f(2.0f,0.0f,2.0f));
        Color3f red = new Color3f(1.0f, 0.0f, 0.0f);
        for (int i=0;i<6;i++)
        triangleArray.setColor(i,red);
        bg1.addChild(new Shape3D(triangleArray,app));
        return bg1;
    }
 
Regards,
Saeed

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.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