quil

lspector 2019-04-23T20:59:36.021900Z

For @pez, demonstrating the "tainted by cross-origin data" problem with loading an image.

pez 2019-04-23T21:02:28.022700Z

I’ll have a look, @lspector. But I’m far from an expert on these things so don’t expect much. 😃

lspector 2019-04-23T21:57:58.026800Z

Thanks @pez. The issue is that we just can't load any image at all. We definitely used to be able to. I just downloaded a fresh version of https://github.com/PEZ/quil-cljs-calva-template, added (q/load-image "prog9.png") to setup, added the image to resources/public, ran lein cljsbuild once, opened index.html, and I get the same error. So it's not anything else about the student's project from which I produced the file attached above.

2019-04-23T23:13:21.031900Z

hmmmm... I see the image here. Once I made it into a functioning quil project in core.cljs, (also shrinking that ginormous image to 211k), "lein compile", and opened index.html, it looks fine. Let me see if I can post my core.cljs ....

(ns drawing-project.core
  (:require [quil.core :as q :include-macros true]
            [quil.middleware :as m]))

;;(enable-console-print!)

(defn setup []
  {:img (q/load-image "prog9.png")})

(defn update-state [state]
  state)

(defn draw-state [state]
  (q/background 200)
  (q/image (:img state) 0 0))

(defn run-sketch []
  (q/defsketch drawing-project
    :host "drawing-project"
    :size [500 500]
    :setup setup
    :update update-state
    :draw draw-state
    :middleware [m/fun-mode]))