-1

I have this code and it doesn't work. How can I fix it?

And how can I change the size of text?

<x3d width='800px' height='400px'>
<scene>
       <shape>
              <Appearance>
                    <ImageTexture url='1.jpg'/>
                </Appearance>
                <Text string='3'>
                    <FontStyle style='BOLD' />
                </Text>
       </shape>
</scene>

Harry
  • 87,580
  • 25
  • 202
  • 214
Petros Vel
  • 23
  • 8
  • Don't make the entire content as bold (adding ---- directly below a line makes the text above it look like heading). Also, *it doesn't work* is not a good problem statement. You should indicate how you expect it to work and also indicate what is happening currently. If you're getting any error messages, include it as part of the question. – Harry Dec 23 '15 at 13:16

1 Answers1

0

You cannot set a font size on a ImageTexture. Anyways, here's an example of creating a textured cube (Box) and putting a Text shape in front of it.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "http://www.web3d.org/specifications/x3d-3.0.dtd">
<X3D>
<Scene>
<Group>
  <Transform>
    <Shape>
     <Appearance>
      <ImageTexture url='1.jpg'/>
     </Appearance>
<Box/>
    </Shape>
    <Transform translation="0 0 1">
      <Shape>
       <Appearance>
<Material/>
       </Appearance>
       <Text string='"This is a text"'>
        <FontStyle family='"SANS"' justify='"MIDDLE"' size="1.5" style="BOLD"/>
       </Text>
      </Shape>
    </Transform>
  </Transform>
</Group>

</Scene>
</X3D>
Traian
  • 2,915
  • 1
  • 24
  • 32
  • This is a homework. I must create 3d text with ImageTexture! i think that is not correct -.- – Petros Vel Dec 24 '15 at 15:01
  • there is no direct way to create 3d text. You need to create each letter as a 3d shape and then attach texture on it by using ImageTexture. – Traian Dec 24 '15 at 23:19
  • Use Blender or some other modeling tool to create the 3D shapes and export as X3D. Alternatively use GIMP (or maybe OpenOffice) to create a 3D looking image. X3D does not have any direct capabilities to create text in 3D. – Daly Realism Dec 29 '15 at 22:06