Hi Pascal,
I just noticed these questions in your previous mail. I don't know if you've
gotten a solution yet, so here goes....
> From: "Pascal Debarge" <[EMAIL PROTECTED]>
>
> Yet I have another question concerning the following code :
>
> public class blablabla ...
> {
>
> TransformGroup tg = null;
> Transform3D trsf = null ;
>
> public blablabla()
> {
> tg = new TransformGroup();
> tg.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
> tg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
> trsf = new Transform3D();
> tg.setTransform(trsf);
> }
>
>
> public void modifyTransform(Vector3d v) // often called
> {
>
> trsf = setTranslation(v); // problem here ....
>
> }
>
> }
>
> The modifyTransform function has no effect. It seems that the transform group
has
> lost track
> of its transform3d. It is working if I add tg.setTransform(trsf) which seems
to burn
> memory.
The TransformGroup has its own Transform3D which is set by setTransform() and
gotten by getTransform(). So you need to call tc.setTransform(trsf) to convey
the changes in trsf to the TransformGroup's Transform3D.
This burns memory, but only because of a bug: changing the transform for the TG
makes J3D run through some leaky code (soon to be fixed, see my mail from
earlier today).
> If I replace this function by the following one :
>
> public void modifyTransform(Vector3d v) // often called
> {
>
> Transform3d trsf = null;
> tg.getTransform(trsf); // problem here ....
> trsf = setTranslation(v);
>
> }
>
> an exception is thrown because trsf is NULL ...Can somebody explain me why ?
The problem is that getTransform is copying the Transform3D from inside the
TransformGroup to your Transform3D. If you pass in a null, then it tries to
copy into null, which generates an exception.
Doug Gehringer
Sun Microsystems
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/