I've done (use 'quil.core) and the Quil namespace seems to be loaded. It shows up in the namespace browser and the symbols seem to be bound to the Quil code. But the dependency on the native Processing package seems to be broken. For example (color 45) throws a NullPointerException. I can see from the trace that the exception is thrown from the Quil color function when it is trying to call the native Processing .color function.
The CCW release note says:
"Of course, when you have an active REPL, and once a namespace from a dependency's jar has been loaded in the REPL, you can open vars from this namespace as usual, via F3, Ctrl/Cmd+Click in the REPL or from the editor, and also by double-clicking on the var from the Namespace Browser.
Native deps are also correctly supported. Meaning you can start hacking with Overtone or Quil and their Sound / OpenGL supports right now!!!"
So how do I get the transitive dependency on the Processing native lib to work in the REPL?
I've tried various forms to get the native lib loaded with no success.
Would some kind soul please share the proper expressions to enter into the REPL so that Quil and the Processing native jar gets loaded?
Thanks for CCW! I love that I can use Clojure in Eclipse.
Using Eclipse Juno on Mac OSX Mountain Lion.
Hello,
OK, so I tested it against Quil 1.6.0. Please can you check the following:
a) expand the "Leiningen Dependencies" node under your project node.
You should see clojure, org.processing.*, quil jars.
b) if you select e.g. org.processing.core jar in the leiningen
dependencies, invoke the contextual menu, and select the "properties"
menu item, select the "Native" Entry on the left of the Properties
popup: You should see "Location Path :
<your-project-name>/target/native/macosx"
c) then, after potentially doing a project refresh, you should see the
target folder under your project, and the native/macosx subfolders as
well ; and a lot of .jnilib files in them.
If you have problems, then try to force a "leiningen refresh" on the
project : project > contextual menu > Leiningen > "Reset project
configuration", and retry steps a) b) & c).
Note that if you've also got leiningen on the command line, and issued
a "lein clean", then the "target/" folder may well have disappeared.
That's something I don't like in Leiningen, the way native
dependencies are dropped in the target/ folder and may disappear
anytime with a clear, when they are really just another kind of
dependency and belong to a more "stable" location on the filesystem.
Anyway.
Hope this helps,
Looking forward to hearing from your report on all this,
--
Laurent
(ns quilTest.core (:use quil.core))
(def HEIGHT 200)
(def WIDTH 320)
(defn setup []
(smooth) ;;Turn on anti-aliasing
(frame-rate 100) ;;Set framerate to 1 FPS
(background 200) ;;Set the background colour to a nice shade of grey.
(color-mode :hsb MAX_HUE MAX_SATURATION MAX_BRIGHTNESS MAX_ALPHA)
(set-image 0 0 (load-image "image.png"))
)
(defn draw []
)
(defsketch example ;;Define a new sketch named example
:title "Wu Xing" ;;Set the title of the sketch
:setup setup ;;Specify the setup fn
:draw draw ;;Specify the draw fn
:size [WIDTH HEIGHT] ;;You struggle to beat the golden ratio
)
---------------
That's it.
Test case:
Setup - Clojure project with Leinigen nature and Quil 1.6.0 dependency.
1. Have source file open in the editor.
2. Click "Clojure->Load File In REPL. Note that image opens in an app window.
3. Move focus to REPL by clicking in REPL pane.
4. Type (use 'quil.core) <enter>
5. Type (color 42) <enter>
NullPointerException quil.core/color (core.clj:787)
(def function-queue (atom []))
(defn append-function
"Append a function to the function queue"
[function]
(swap! function-queue #(conj %1 function))
)
(defn eval-functions
"Evaluate all functions in the function-queue and empty it"
[]
(let [pending-functions @function-queue]
(reset! function-queue [])
(doseq [function pending-functions]
(function))))
(defn invoke-now
"Add a function to the function-queue and block until it returns"
[function]
(let [p (promise)]
(append-function #(deliver p (function)))
@p))
(defn draw []
(eval-functions)
)