Display Image

It is a very basic question, I am trying to load an image that is inside the same folder of the index.html file but I can't. Here the code of the sketch:

var img;
function setup() {
  createCanvas(windowWidth, windowHeight);
  img=loadImage("img1.png");
}

function draw() {
  image(img,0,0);
}

And here the code of the index.html:

<html>
<head>
  <title>IMAGE</title>

  <script language="javascript" type="text/javascript" src="../../lib/p5.js"></script>
  <script language="javascript" type="text/javascript" src="sketch.js"></script>

</head>
<body>

</body>
</html>

What am I doing wrong? Thanks in advance!

Answers

Sign In or Register to comment.