开发者

shape3d texture or colour not showing

I have created a flat square in a java 3d enviroment, and at the moment it is white, i have tried to apply a texture but it just changes to grey! i know the code is correct as if i set the appearance on a box it show correctly.

So then i tried to use just a basic colour, but this doesnt show either! am i missing something here, is there something else i need to do in order to colour custom shape3d objects?

this is what i have;

    QuadArray polygon1 = new QuadArray (4, QuadArray.COORDINATES);
        polygon1.setCoordinate (0, new Point3f (-2f, -1f, 2f));
        polygon1.setCoordinate (1, new Point3f (2f, -1f, 2f));
        polygon1.setCoordinate (2, new Point3f (2f, -1f, -2f));
        polygon1.setCoordinate (3, new Point3f (-2f, -1f, -2f));





    Material yellowProps = new Material();
yellowProps.setAmbientColor(1.0f,1.0f,0.0f); //yellow cone
polygon1Appearance.setMaterial(yellowProps);



objRoot.addChild(new Shape开发者_JAVA百科3D(polygon1,polygon1Appearance));


You should enable and set up lighting to see your material, otherwise default ColoringAttributes will be used. Materials are used when shape is shaded

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜