tags:

views:

416

answers:

1

I am trying to draw a transparent plane (X[0..100],Y[0..100],Z=0) in Java 3D, but can't figure out how. I've looked on the tutorial page and still can't find any sample programs.

I am attempting to find a "plane" object as a BranchGroup to add to my existing TransformGroup, but there isn't such a plane object; what should I use? And how do I make it transparent?

A: 

This is a snippet of code I used on a histogram - this might work on a flat plane.

private static void createAppearances() {
     normalAppearance = new Appearance();
     normalAppearance.setMaterial(normalMaterial);
     selectedAppearance = new Appearance();
     selectedAppearance.setMaterial(selectedMaterial);
     TransparencyAttributes ta = new TransparencyAttributes();

     ta.setTransparencyMode (ta.BLENDED);
     ta.setTransparency (DEFAULT_HISTOGRAM_ALPHA);

     normalAppearance.setTransparencyAttributes (ta);
     selectedAppearance.setTransparencyAttributes(ta);
    }

The key is the TransparencyAttributes if I remember correctly. I wish I could tell you more but I can't get this to compile right now (missing some old libraries that aren't related to 3D).

M1EK