Hello,
I'm trying to set transparency to a VRML object. But all the Java 3D
examples I saw, use Appearance, TransparencyAttributes and
TransparencyInterpolator. But I don't know how to set Appearance for a Scene
object.
Pieces of my code Below:
private Scene scene;
private BranchGroup sceneBranchGroup = null;
scene = createVRML();
sceneBranchGroup = transparencyVRML(scene);
protected Scene createVRML( )
{
VrmlLoader loader = new VrmlLoader();
Scene s = null;
try
{
s = loader.load("h16.WRL");
}
catch(Exception e)
{
e.printStackTrace();
System.exit(-1);
}
return s;
}
protected BranchGroup transparencyVRML(Scene s)
{
BranchGroup objRoot = new BranchGroup();
// create target Transparency with Capabilities
TransparencyAttributes objTransp = new TransparencyAttributes();
objTransp.setCapability(TransparencyAttributes.ALLOW_VALUE_WRITE);
objTransp.setTransparencyMode(TransparencyAttributes.BLENDED);
objTransp.setTransparency(0.7f);
// create Alpha
Alpha alpha = new Alpha (-1,
Alpha.INCREASING_ENABLE +
Alpha.DECREASING_ENABLE,
0, 0, 2000, 0, 1000, 2000, 0, 1000);
// create transparency interpolator
TransparencyInterpolator traInt = new TransparencyInterpolator
(alpha, objTransp);
traInt.setSchedulingBounds(bounds);
objRoot.addChild(s.getSceneGroup());
Appearance transpAppear = (????) ;
// above I have to set the appearance of object s
transpAppear.setTransparencyAttributes(objTransp);
objRoot.addChild(traInt);
objRoot.setUserData( "Transparency" );
return objRoot;
}
Please, help me. I'm trying for weeks to solve this problem.
Thanks, Melina
===========================================================================
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".