I am trying to make an X3DOM box shape containing an "ImageTexture" that accesses a local file. However, it seems to only be able to find my pictures when I give the "url" attribute an https:// link. Here is my code and the folder setup of the local picture file and html doc; "index.html" is the html file my code is from and "one.png" is the png picture I am trying to load onto the shape:
<transform translation = "1.75 0 0">
<shape>
<appearance>
<!--<material diffuseColor = "0 1 1"></material>-->
<ImageTexture url="one.png"></ImageTexture>
</appearance>
<box size = "0 4 4"/>
</shape>
</transform>
.
├── index.html
├── one.png
├── pics
│ ├── 1.png
│ ├── 2.jpeg
│ ├── 3.jpeg
│ ├── 4.png
│ ├── 5.png
│ └── 6.jpeg
├── style.css
├── test.html
├── x3dom.css
└── x3dom-full.js
1 directory, 12 files
The box shows up when I use the "material" tag, just not with images from local files. I am using the latest version of x3d - 1.8.1, what could be the issue for the images not showing up?
First I would try with another picture (maybe a JPEG) to be sure it's not related to the picture itself. You can also test the picture by opening it with a photo editor. I know it sounds stupid but it happened to me.
Then, or maybe this should be the first test, look in the console (I suppose it's in the web so look for the console
settings -> more tools -> developer tools) to see what error message you receive. That'll probably solve your issue.Third, again might sound stupid but it can happen, put the absolute path to the image (e.g.
url="C:/myPics/whatever/one.png"). Also you can try just adding "./" before the image name, e.g.url="./one.png"Hope this helps!