I am currently learning WebGL. In a call to texImage2D, which is called when a texture has finished loading, I get the following SecurityError
:
Uncaught SecurityError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': The cross-origin image at /path/to/texure.png may not be loaded.
However, the file is on the same domain, in fact it is in the same directory as the html file requesting it.
Here is the file layout:
> js
|-> script.js
|-> glUtils.js
|-> sylvester.js
> texture.png
> index.html
And when I look in the F12 console's resource list, the image texture.png
is there, fully loaded, and it is 256 x 256. Why does it think I am requesting from another domain?