Here is the method which will create a box with 4 faces only and I load the
texture with TextureLoader and use MODULATE as parameter.  It works
perfectly if I create a box with the class Box but not this:

private BranchGroup createBox(){
                BranchGroup root = new BranchGroup();
                Point3f coord[] = new Point3f[16];

                coord[0] = new Point3f(-0.4f, 0.4f, 0.0f);
                coord[1] = new Point3f(0.4f, 0.4f, 0.0f);
                coord[2] = new Point3f(-0.4f, -0.4f, 0.0f);
                coord[3] = new Point3f(0.4f, -0.4f, 0.0f);

                coord[4] = new Point3f(0.4f, 0.4f, 0.0f);
                coord[5] = new Point3f(0.4f, 0.4f, -0.4f);
                coord[6] = new Point3f(0.4f, -0.4f, 0.0f);
                coord[7] = new Point3f(0.4f, -0.4f, -0.4f);

                coord[8] = new Point3f(0.4f, 0.4f, -0.4f);
                coord[9] = new Point3f(-0.4f, 0.4f, -0.4f);
                coord[10] = new Point3f(0.4f, -0.4f, -0.4f);
                coord[11] = new Point3f(-0.4f, -0.4f, -0.4f);

                coord[12] = new Point3f(-0.4f, 0.4f, -0.4f);
                coord[13] = new Point3f(-0.4f, 0.4f, 0.0f);
                coord[14] = new Point3f(-0.4f, -0.4f, -0.4f);
                coord[15] = new Point3f(-0.4f, -0.4f, 0.0f);
                int stripCount[] = {20};
                TriangleStripArray tsa = new TriangleStripArray(20,
TriangleStripArray.COORDINATES | TriangleStripArray.NORMALS |
TriangleStripArray.TEXTURE_COORDINATE_3, stripCount);
                tsa.setCoordinates(0, coord);
                TransformGroup tg = new TransformGroup();
                tg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
                tg.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
                Shape3D shape = new Shape3D(tsa);
                tg.addChild(shape);
                Appearance appearance = new Appearance();
                TextureLoader tl = new TextureLoader(new
String("./Textures/Floor2.jpg"), new String("RGB"), 0, null);
                appearance.setTexture(tl.getTexture());
                TextureAttributes ta = new TextureAttributes();
                ta.setTextureMode(TextureAttributes.MODULATE);
                appearance.setTextureAttributes(ta);
                PolygonAttributes pa = new PolygonAttributes();
                pa.setCullFace(PolygonAttributes.CULL_FRONT);
                pa.setPolygonMode(PolygonAttributes.POLYGON_FILL);
                appearance.setPolygonAttributes(pa);
                shape.setAppearance(appearance);
                MouseRotate mr = new MouseRotate(tg);
                mr.setSchedulingBounds(new BoundingSphere());
                root.addChild(mr);
                root.addChild(tg);
                return root;
        }

I don't know why the texture was loaded into the lines instead of the box I
created, any hints?  Thanks to all of you.

Andy

===========================================================================
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".

Reply via email to