Hi,
I'm trying to vary the transparency of a cube during the simulation
execution.
I define the following....
public sim.portrayal3d.simple.CubePortrayal3D representation;
representation = new sim.portrayal3d.simple.CubePortrayal3D(colour,size)
And then attempt to change the transparency by...
representation.appearance.getTransparencyAttributes().setTransparency(1.0f);
I noticed that nothing was appearing, looked like the cubes had 0
transparency.
Surrounding the setTransparency call with a try catch I realised the
follow exception was being thrown...
javax.media.j3d.CapabilityNotSetException: Appearance: no capability to
get transparencyAttributes
Looking into CubePortrayal3D.getModel I found the following...
131: Shape3D localShape = new Shape3D(quadArray,appearance);
132: localShape.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
Which should allow you to change the appearance properties of the Shape3D.
However, is the problem that I'm calling getTransparencyAttributes()
when localShape.setCapability(Shape3D.ALLOW_APPEARANCE_READ); has not
been set?
Or I'm I going about this all the wrong way? How should I change the
transparency of a CubePortrayal3D (or more generally any Portrayal3D).
Thanks
--
Michael Lees
This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.
|