Hello Chu,
If I understand your intent correctly, you're going to far more effort than
necessary.
The Java3D engine is continually updating the canvas, especially when you
change something, so there's no need to explicitly ask for an update.
If you want to change the position of something, removing it and
re-inserting it is a slow and difficult way to do it. Instead, you should
attach the object to a Transform3D node (between the Locale and the
BranchGraph or between the BranchGroup and the object), then to change the
position of the object you need only change the characteristics of the
transform. This will allow you to move the object more or less continuously
as the user moves the slider.
Hope this helps,
-Carl-
At 01:02 09.11.00 , you wrote:
>I'm very new at Java3d..
>
>What's the way to go about updating branchgroups and redrawing canvas?
>
>I've a couple of sliders that sets the position of couple of objects in 3d
>and user need to click redraw button to redraw the canvas3d.
>
>This is my attempt, I've very little concept of Locale and SimpleUniverse.
>So I am not sure if I'm detaching anything important..
>
> public void actionPerformed(ActionEvent e){
> javax.media.j3d.Locale aLocale = u.getLocale(); // u is
>simpleuniverse
> Enumeration bGEnum = aLocale.getAllBranchGraphs();
> u.getCanvas().stopRenderer();
> BranchGroup aBG;
> try{
> while ((aBG = (BranchGroup)bGEnum.nextElement()) != null){
> if (aBG.getCapability(BranchGroup.ALLOW_DETACH))
> aBG.detach(); // detach everything.
> }
> }
> catch(NoSuchElementException except){
> }
> BranchGroup scene;
> scene = aRobot.generateBranchGroup(); // The new scene, already set
>capability to detachable
> scene.compile();
> u.addBranchGraph(scene);
> u.getCanvas().startRenderer();
>}
>
>
>_________________________________________________________
>Do You Yahoo!?
>Get your free @yahoo.com address at 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".
===========================================================================
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".