Here is the method for compiling the branchgroup returned from createView()
method and add to locale:
public JEngine(String vu){
Frame frame = new Frame(vu);
frame.setLayout(new BorderLayout());
frame.setUndecorated(true);
frame.setBackground(Color.BLACK);
GraphicsEnvironment ge =
GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice d = ge.getDefaultScreenDevice();
if(d.isFullScreenSupported())
d.setFullScreenWindow(frame);
GraphicsConfiguration[] gc = d.getConfigurations();
GraphicsConfigTemplate3D gct = new
GraphicsConfigTemplate3D();
GraphicsConfiguration graphics =
gct.getBestConfiguration(gc);
if(gct.isGraphicsConfigSupported(graphics))
System.out.println("Graphics Device Supported");
else{
System.out.println("Graphics Device NOT Supported");
System.exit(1);
}
Canvas3D c3d = new Canvas3D(graphics);
Button button = new Button("Exit");
button.addActionListener(new ActionEvents());
frame.add(c3d, BorderLayout.CENTER);
frame.add(button, BorderLayout.SOUTH);
frame.addKeyListener(new KeyEvents());
BranchGroup bg = createBox();
bg.compile();
VirtualUniverse u = new VirtualUniverse();
Locale locale = new Locale(u);
BranchGroup bg2 = createView(c3d);
bg2.compile();
locale.addBranchGraph(bg);
locale.addBranchGraph(bg2);
frame.show();
}
I followed the scene graph structure, compile the BranchGroup returned from
createView() and add to locale, and locale is attached to the Virtual
Universe. I don't know why the KeyNavigatorBehavior doesn't work that way.
Thanks for replying.
Andy
----- Original Message -----
From: "Mark Hood" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 13, 2002 3:06 PM
Subject: Re: [JAVA3D] Camera
> > Date: Tue, 13 Aug 2002 11:46:19 -0500
> > From: Andy <[EMAIL PROTECTED]>
> > Content-Length: 4565
> >
> > Sorry for not telling specific enough, here is my code:
>
> Looks OK so far... what do you do with the BranchGroup returned by your
> createView() method? SimpleUniverse creates a ViewingPlatform BranchGroup
and
> attaches it to the universe for you. It looks like you're essentially
> reimplementing ViewingPlatform but perhaps you're not making it live.
>
> Keep posting more of your code, someone ought to see the problem
eventually.
> If you send a complete test app that reproduces the problem, we can
determine
> if it's a bug that needs to be investigated.
>
> -- Mark Hood
>
> > /**
> > * BranchGraph for View BranchGroup
> > */
> > private BranchGroup createView(Canvas3D c){
> > BranchGroup bg = new BranchGroup();
> > View view = new View();
> > view.setSceneAntialiasingEnable(false);
> > ViewPlatform vp = new ViewPlatform();
> > vp.setViewAttachPolicy(View.NOMINAL_SCREEN);
> > PhysicalBody body = new PhysicalBody();
> > PhysicalEnvironment pe = new PhysicalEnvironment();
> > view.addCanvas3D(c);
> > view.attachViewPlatform(vp);
> > view.setPhysicalBody(body);
> > view.setPhysicalEnvironment(pe);
> > TransformGroup tg = new TransformGroup();
> > tg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
> > tg.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
> > bg.addChild(tg);
> > tg.addChild(vp);
> > KeyNavigatorBehavior key = new KeyNavigatorBehavior(tg);
> > key.setSchedulingBounds(new BoundingSphere());
> > bg.addChild(key);
> >
> > return bg;
> > }
>
>
===========================================================================
> 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".