The primitive utilities cache the Geometry references used to represent
the geometry.  If a creation request can be fulfilled with existing
Geometry objects, they is used.  In your case, the same Geometry references
are being used by all of your Cylinder objects.  By the time your code creates
the last view, the Geometry references from the first view have become live.
Since they are shared, the ones for the last view are live as well.

To prevent the primitive utilities from caching geometry references, pass
in Primitive.GEOMETRY_NOT_SHARED as a primitve creation flag.  Your memory
consumtion will go up, but the live problem will go away.

Doug Twilleager
Sun Microsystems

>MIME-Version: 1.0
>Subject: [JAVA3D] live cylinder geometry? why?
>To: [EMAIL PROTECTED]
>
>My application has 3 different j3d views.
>Each of my j3d view contains one to two cylinders.
>The code segment for cylinder creation looks like this ...
>
>
>            int[] parts = {Cylinder.TOP, Cylinder.BODY, Cylinder.BOTTOM};
>
>            Cylinder cylinder = new Cylinder(radius, dist);
>
>            for (int i = 0; i < parts.length; i++) {
>                Shape3D shape = cylinder.getShape(parts[i]);
>                if (shape != null) {
>                    /* set shape capability here */
>                Geometry geometry = shape.getGeometry();
>                 if (geometry != null) {
>                       geometry.setCapability(Geometry.ALLOW_INTERSECT);
>                 }
>             }
>            }
>
>The first view and second view work perfectly.  The third view
>does not allow me to set the capability of the body geometry.
>The error says the geometry is "live".  I checked the shape
>of the body cylinder.  It is NOT live.  How can the geometry
>be "live"?  I have not attached the cylinder to any transform
>group yet.  Why does the code work for the other two views?
>
>Yang
>
>===========================================================================
>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".

Reply via email to