htmlcolorsxhtmlx3dx3dom

Color faces in X3D not working


I've defined some faces in X3D and am trying to assign colours to them. I have the code below, but when I load the model, nothing appears and it just shows "hardware buffering". It loads ok (and shape is correct) when I get rid of the parts related to colour definition. Any ideas what's wrong here? Thanks!

<x3d>
    <Scene>
        <Group>
        <Transform translation="0 1.829 0">
        <Transform center="0 -1.829 0" rotation="0.0000 0.0000 -1.0000 1.5708" translation="18.288 -3.658 11.582">
        <Transform center="0 -1.829 0" rotation="0 1 0 0.0000">
            <Shape>
                <Appearance><Material diffuseColor="0.0000 0.0000 1.0000"/></Appearance>
                <IndexedFaceSet solid='true' coordIndex='0 1 2 3 -1 7 6 5 4 -1 0 4 5 1 -1 1 5 6 2 -1 2 6 7 3 -1 3 7 4 0 -1'>
                    <Coordinate point='-0.004 1.829 0.174 0.004 1.829 0.174 0.004 1.829 -0.174 -0.004 1.829 -0.174 -0.004 -1.829 0.174 0.004 -1.829 0.174 0.004 -1.829 -0.174 -0.004 -1.829 -0.174'/>
                </IndexedFaceSet>
            </Shape>
            <Shape>
                <Appearance><Material/></Appearance>
                <IndexedFaceSet colorPerVertex='false' solid='true' colorIndex='1 1 0 1 1 1' coordIndex='0 1 2 3 -1 7 6 5 4 -1 0 4 5 1 -1 1 5 6 2 -1 2 6 7 3 -1 3 7 4 0 -1'>
                    <Color color="0.8627 0.8627 0.8627 0.0000 0.0000 1.0000"/>
                    <Coordinate point='-0.1015 1.829 0.174 0.1015 1.829 0.174 0.1015 1.829 0.16 -0.1015 1.829 0.16 -0.1015 -1.829 0.174 0.1015 -1.829 0.174 0.1015 -1.829 0.16 -0.1015 -1.829 0.16'/>
                </IndexedFaceSet>
            </Shape>
        </Transform>
        </Transform>
        </Transform>
        </Group>
    </Scene>
</x3d>

Solution

  • The code was correct but the reason it wasn't working was that I was creating an .html file rather than an .xhtml file for x3dom.