Re: Objects fall outside simpleuniverse
Posted by bchinfosieeuw on Jul 22, 2018; 11:34am
URL: https://forum.jogamp.org/Objects-fall-outside-simpleuniverse-tp4039062p4039064.html
Part of my code below, now Sphere 6 is not shown.
public class MyC extends Applet implements ActionListener, KeyListener {
public BranchGroup createSceneGraph() {
// Create the root of the branch graph
BranchGroup objRoot = new BranchGroup();
objRoot.setCapability(Group.ALLOW_CHILDREN_EXTEND);
//Sphere 6
TransformGroup sphere6TransGroup = translate(sphere6, new Vector3f(0.6f,0.93f,0.0f));
objTransYour6Sph = new TransformGroup();
objTransYour6Sph.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
objRoot.addChild(objTransYour6Sph);
objTransYour6Sph.addChild(sphere6TransGroup);
}
public MyC() {
setLayout(new BorderLayout());
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
Canvas3D c = new Canvas3D(config);
add("Center", c);
c.addKeyListener(this);
timer = new Timer(100,this);
//timer.start();
Panel p =new Panel();
p.add(go);
add("North",p);
go.addActionListener(this);
go.addKeyListener(this);
// Create a simple scene and attach it to the virtual universe
BranchGroup scene = createSceneGraph();
SimpleUniverse u = new SimpleUniverse(c);
u.getViewingPlatform().setNominalViewingTransform();
u.addBranchGraph(scene);
//u.getViewer().getView().setFieldOfView(Math.toRadians(90.0));
OrbitBehavior orbit = new OrbitBehavior(c, OrbitBehavior.REVERSE_ROTATE);
orbit.setSchedulingBounds(new BoundingSphere());
u.getViewingPlatform().setViewPlatformBehavior(orbit);
}
public static void main(String[] args) {
System.out.println("Program Started");
System.setProperty("sun.awt.noerasebackground", "true");
MyC bb = new MyC();
bb.addKeyListener(bb);
MainFrame mf = new MainFrame(bb, 1056, 1056);
}
}