Hi,
> Why is nothing simple???
Ho Ho, nothing is simple in 3D even with java ;-))
The problem you have IS simple, but you do not look at the right object.
you must *not* set the capability bits to the sphere itself but rather
at the shape3D it contains (which in fact is kind of child (0) of child(0)
of the sphere group object : a sphere extends a primitive which extends a
group, ouf!!). Hopefully, there is a constructor which enables you
to specify that you want to modify (i.e. both read and write) later your
sphere appearance, so the flags ALLOW_APPEARANCE_READ|WRITE are set
automatically to the internal shape3d of the sphere at initialization time.
This flag is ENABLE_APPEARANCE_MODIFY (defined in class Primitive).
So you should build your sphere with:
new Sphere (radius, Sphere.ENABLE_APPEARANCE_MODIFY, null);
and it should work (I hope ;-))
sincerly
renaud
> I define MySphere as an extension of Sphere.
> I add it to my scene graph.
>
> MySphere theSphere = new MySphere();
> theSphere.setAppearance(createAppearanceProton());
> theSphere.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
> theSphere.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
> objPSize.addChild(theSphere);
>
> Note the ALLOW_APPEARANCE_READ capability....
>
> After the scene is compiled and active, I want to change the sphere's
> color. So I get the appearance of the sphere by
>
> Appearance PA = theApp.theSphere.getAppearance();
> Material theMaterial = PA.getMaterial();
> theMaterial.setDiffuseColor(red, green, blue);
>
> But this fails with a
> "Shape3D: no capability to get appearance"
> exception.
>
> So how do you set the capability to read (and write) the
> appearance of a Sphere object? Or is there some other
> problem which is preventing me from doing this?
>
> Bob Gray
>
> ==============================================================
> =============
> 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".