using Syphon to pipe graphics from quil to other apps

96 views
Skip to first unread message

Kasper Jordaens

unread,
May 11, 2016, 5:38:03 PM5/11/16
to clj-processing
Hi,


I want to pipe my sketches to Syphon using the syphon processing library. This works reliably from processing and is as simple as importing the library and running a function at the end of draw(). I succeed in in importing the library in clojure/quil, but then I'm stuck. How do i create the "server object", how can I call it?
not a total clojure noob, but close enough I guess :)

this is the part that does not crash

I added the libs in the projects resources folder and added:

  :resource-paths [
                   
"Syphon/library/jsyphon.jar"
                   
"Syphon/library/libJSyphon.jnilib"
                   
"Syphon/library/Syphon.framework"
                   
"Syphon/library/Syphon.jar"
                   
]

to my project.clj

in my namespace I can use 

(:import [codeanticode.syphon])

which loads fine. but from thenn on, I'm stuck, I have no idea on how to implement the three other lines of required code :/

SyphonServer server;
in the setup routine:
server = new SyphonServer(this, "Processing Syphon");
in the draw routine:
server.sendScreen();

So this code from processing

import codeanticode.syphon.*;


SyphonServer server;


void setup() {
  size
(400,400, P3D);
 
 
// Create syhpon server to send frames out.
  server
= new SyphonServer(this, "Processing Syphon");
}


void draw() {
  background
(127);
  lights
();
  translate
(width/2, height/2);
  rotateX
(frameCount * 0.01);
  rotateY
(frameCount * 0.01);  
  box
(150);
  server
.sendScreen();
}

works fine.

can this be done in quil?

thanks

Kasper


Nikita Beloglazov

unread,
May 12, 2016, 1:19:05 AM5/12/16
to clj-processing
Hi Kasper

Yes, it is possible. I added it to FAQ: https://github.com/quil/quil/wiki/FAQ#how-to-use-processing-plugin Essentially you just need to translate java example to clojure using java interop. Hope this helps.

Thanks,
Nikita

--
You received this message because you are subscribed to the Google Groups "clj-processing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clj-processin...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kasper Jordaens

unread,
May 12, 2016, 5:27:21 AM5/12/16
to clj-processing
great step forward! The FAQ was pretty straightforward


I can import, and run the code, but it is still missing something. Although I import the dependencies (and I even get ClassName codecompletion) I get a :

Exception in thread "Thread-125" java.lang.RuntimeException: java.lang.NoClassDefFoundError: Could not initialize class jsyphon.JSyphonServer
 at processing
.opengl.PSurfaceJOGL$2.run(PSurfaceJOGL.java:443)
 at java
.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class jsyphon.JSyphonServer
 at codeanticode
.syphon.SyphonServer.sendImage(Unknown Source)
 at codeanticode
.syphon.SyphonServer.sendScreen(Unknown Source)
 at sun
.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

if I manually import jsyphon at the repl I get 

=> 'import jsyphon.JSyphonServer
import


CompilerException java.lang.NoClassDefFoundError: Could not initialize class jsyphon.JSyphonServer

I definitely see something here...




Where else would it get the classnames.

Stuck again :/

any idea?

Thanks!

Kasper Jordaens

unread,
May 12, 2016, 7:23:27 AM5/12/16
to clj-processing
ah ok, one step further
.core=> Syphon 1.0-RC3 by Andres Colubri http://interfaze.info/
Exception in thread "Thread-110" java.lang.UnsatisfiedLinkError: no JSyphon in java.library.path
 at processing
.opengl.PSurfaceJOGL$2.run(PSurfaceJOGL.java:441)
 at java
.lang.Thread.run(Thread.java:745)



apparently there is a path missing, or a link missing in a path

core=> (println (. System getProperty "java.library.path"))
/Users/kaos/Documents/4_halic/codedspace/target/native/macosx/x86_64
nil

after getting this path, and reading there is some problem https://github.com/Syphon/Processing/issues/18 with Syphon and java paths and dropping all libraries in that folder Syphon Server runs and is detected by other clients!

I can only grab black frames though, but I'll be on the syphon mailing list for that :)

Kasper Jordaens

unread,
May 12, 2016, 9:24:40 AM5/12/16
to clj-processing
the black frames thing is because of a processing 3 problem

I downgraded to quil [2.1.0] and the problem is solved
check here for more info

Kasper

Nikita Beloglazov

unread,
May 12, 2016, 4:46:47 PM5/12/16
to clj-processing
Great. So you figured out quil-related problems then? I don't think I can do much about Syphon not supporting OpenGL 3 :/ 
Reply all
Reply to author
Forward
0 new messages