hi,

Are there any known problems with the DecalGroup class?  I'm having a
problem where the children of a DecalGroup display fine, but objects outside
of the DecalGroup don't get displayed.  See the attached test program
HelloUniverse.java, the ColorCube isn't displayed if the DecalGroup node is
attached to the scene graph.  I'm using Java 3D 1.1.1 on Windows / OpenGL.



import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.event.*;
import java.awt.GraphicsConfiguration;
import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.universe.*;
import javax.media.j3d.*;
import javax.vecmath.*;
import com.sun.j3d.utils.geometry.ColorCube;

public class HelloUniverse extends Applet {
    public BranchGroup createSceneGraph() {
        // Create the root of the branch graph
        BranchGroup objRoot = new BranchGroup();

        objRoot.addChild(new ColorCube(0.25f));

   Point3f coords1[] = new Point3f[4];
        coords1[0] = new Point3f(-1f, -.75f, -3f);
        coords1[1] = new Point3f(-1f, -.75f, -1f);
        coords1[2] = new Point3f(1f, -.75f, -1f);
        coords1[3] = new Point3f(1f, -.75f, -3f);

        Color3f colors1[] = new Color3f[4];
        for (int i=0; i<4; i++)
                colors1[i] = new Color3f(0.0f, 1.0f, 0.0f);

        QuadArray plane1 = new QuadArray(4, QuadArray.COORDINATES |
QuadArray.COLOR_3);
        plane1.setCoordinates(0, coords1);
        plane1.setColors(0, colors1);

   Point3f coords2[] = new Point3f[4];
        coords2[0] = new Point3f(-.5f, -.75f, -2.5f);
        coords2[1] = new Point3f(-.5f, -.75f, -1.5f);
        coords2[2] = new Point3f(.5f, -.75f, -1.5f);
        coords2[3] = new Point3f(.5f, -.75f, -2.5f);

        Color3f colors2[] = new Color3f[4];
        for (int i=0; i<4; i++)
                colors2[i] = new Color3f(1.0f, 1.0f, 1.0f);

        QuadArray plane2 = new QuadArray(4, QuadArray.COORDINATES |
QuadArray.COLOR_3);
        plane2.setCoordinates(0, coords2);
        plane2.setColors(0, colors2);

        Shape3D plane1_shape = new Shape3D();
        Shape3D plane2_shape = new Shape3D();

        plane1_shape.setGeometry(plane1);
        plane2_shape.setGeometry(plane2);
        
        DecalGroup objDecal = new DecalGroup();
        objRoot.addChild(objDecal);
        objDecal.addChild(plane1_shape);
        objDecal.addChild(plane2_shape);

        // Have Java 3D perform optimizations on this scene graph.
        objRoot.compile();

        return objRoot;
    }

    public HelloUniverse() {
        setLayout(new BorderLayout());
        GraphicsConfiguration config =
           SimpleUniverse.getPreferredConfiguration();

        Canvas3D c = new Canvas3D(config);
        add("Center", c);

        // Create a simple scene and attach it to the virtual universe
        BranchGroup scene = createSceneGraph();
        SimpleUniverse u = new SimpleUniverse(c);

        // This will move the ViewPlatform back a bit so the
        // objects in the scene can be viewed.
        u.getViewingPlatform().setNominalViewingTransform();

        u.addBranchGraph(scene);
    }

    public static void main(String[] args) {
        new MainFrame(new HelloUniverse(), 256, 256);
    }
}

=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/

Reply via email to