processing / p5.js

p5.js is a client-side JS platform that empowers artists, designers, students, and anyone to learn to code and express themselves creatively on the web. It is based on the core principles of Processing. http://twitter.com/p5xjs —
http://p5js.org/
GNU Lesser General Public License v2.1
21.46k stars 3.29k forks source link

loadImage not working in Edge #1354

Closed techbrarian closed 8 years ago

techbrarian commented 8 years ago

A P5.js application I'm building won't work in Edge . . . in tracing out the problem the failure seems to begin at the loadImage method. It never seems to resolve. I'm attempting to load a data uri, but when I tested the problem with a regular image I got the same results.

ghost commented 8 years ago

Is there an error that you get in the console?

techbrarian commented 8 years ago

No errors appeared originally, but some interesting things happened as I continued to experiment with image uri and image size.

  1. A relatively small image loaded with no trouble (from a data uri).
  2. Eventually, after some tweaking, the much larger image throws an error (SCRIPT5022: IndexSize Error p5.js(21030,3))
  3. The specific line in p5.js being referenced is the 21030 line that draws an image to the canvas and is commented a "Copy the Image Back".
  4. I don't have this trouble in FF or Chrome.
techbrarian commented 8 years ago

Okay; I got this sorted out. Turns out I had traced the problem incompletely . . . the issue was in the draw function. I was resizing an image and one of my parameters was going in as a float instead of an integer. Chrome and FF sorted it out, but Edge, IE and Safari, not so much. After I added Math.round() everything was copacetic.