CityScope / CSL_Lima

0 stars 2 forks source link

Image not found #30

Closed agrignard closed 5 years ago

agrignard commented 5 years ago

Trying to run the dev branch however I get the following error:

The file "data/background/white.png" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.

JesusGarcia98 commented 5 years ago

Hello!

I put a comment above the code where the images are loaded indicating that, for some reason, Processing requires the absolute path to the image to properly load it. You need to drag the image to a terminal window and copy the whole path that appears there. Once copied, simply replace "data/background/white.png" with its absolute path. This has to be done for each image.

A simpler solution is to use dataPath("background/white.png"), dataPath("background/black.png"), dataPath("background/color.png") when loading the files.

agrignard commented 5 years ago

I am not sure you need an absolute path. I have many projects that loads image withtout giving an absolute path.

The image should be loaded by default. It's the case in the master branch for instance https://processing.org/reference/loadImage_.html

JesusGarcia98 commented 5 years ago

After investing and testing some changes, I think that Processing only loads the image by default (without using an absolute path) when the "loadImage()" function is used in main. Since I was loading the images in a class placed in another .pde file, that might be why the error occurred.

To avoid the bug, I passed the already loaded images to the constructor instead of the paths and it worked like a charm. This fix, along with a small fix for QRreader and an update in the README that includes the changes is now in the dev branch.

agrignard commented 5 years ago

Good job!