Closed blueberry closed 12 months ago
Thanks Dragan for bringing it up. Didn't realize that that Processing 4 is underway. Yes, we should definitely move Quil to it. Will start a branch for processing 4. Curious how much actual work it will involve. Maybe little if they didn't change java API significantly.
Just a quick info that Processing 4.0 alpha 2 has been released a few days ago.
@nbeloglazov would love to take a stab at it, as i need P2D working on macos catalina which is fixed in v4
i can't find the quil/processing-core
repo though ?
quil/processing-core
is just an uploaded processing jar to clojars. It doesn't have github repo. Here are the instructions for updating processing for Quil. Though you don't have permissions to upload to quil/processing-core
. Instead I suggest to install core.jar to local repo. I think you can use by using file://$HOME/.m2/repository
as repo URL as described here.
I also checked processing 4 and couldn't find couple extra jars such as pdf
, dxf
and svg
. Don't know if processing 4 is planning to support those capabilities. We might have to remove support if processing stops supporting those.
sorry for the silence, was quite busy but made a start and it works pretty much
Few weeks ago, the last release, Processing 4 beta 1, became the default download on the Processing site! The release notes say it's more stable (powerful, modern, etc.) than the "stable" release 3.5.1.
Does this make porting quil easier?
Processing 4 Beta has been out for a while https://github.com/processing/processing4/releases
Any plans on updating it ?
i bundled up the new processing jars
if anyone is intersted they can try it our here [com.github.shrynx/processing-core "4.0.0-beta-8"]
@shrynx awesome! I don't know how to get Quil updated, but I can report that I was able to get some Processing code working on my M1 mac with that exact beta. So I would LOVE to get Quil going now.
There is a new RC for yogamp: https://jogamp.org/deployment/maven/org/jogamp/gluegen/gluegen-rt-main/2.4.0-rc-20230123/ that is not even used by the latest processing version 4.1.2 (4.1.2 still uses an older RC of 2.4.0, that is not available in the jogamp repo anymore, it seems)
It might be worth a try, but I have problems generating the fatjar with the update script (https://gist.github.com/nbeloglazov/11332612), because there seem to be multiple META-INF/MANIFEST.MF
and I get an exception when trying to build gluegen
. jogl
works fine.
Also, @nbeloglazov you spoke about a test setup here to reproduce the error on java https://github.com/quil/quil/pull/337. Could you provide that perhaps? I am willing to invest some time into this problem. Any help would be appreciated. If anyone wants to help please contact me.
@Empyreans I dug up some code. Here is what I did:
https://gist.github.com/nbeloglazov/bde9483165a48de9c47932170ef64cc3
And here is the error I'm getting:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /home/nbeloglazov/repos/sandbox/natives/linux-amd64//libgluegen_rt.so
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2633)
at java.base/java.lang.Runtime.load0(Runtime.java:768)
at java.base/java.lang.System.load(System.java:1837)
at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:625)
at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:64)
at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:107)
at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:488)
at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:427)
at com.jogamp.common.os.Platform$1.run(Platform.java:321)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at com.jogamp.common.os.Platform.<clinit>(Platform.java:290)
at com.jogamp.nativewindow.NativeWindowFactory$1.run(NativeWindowFactory.java:239)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at com.jogamp.nativewindow.NativeWindowFactory.<clinit>(NativeWindowFactory.java:236)
at com.jogamp.newt.NewtFactory$1.run(NewtFactory.java:69)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at com.jogamp.newt.NewtFactory.<clinit>(NewtFactory.java:66)
at App.main(App.java:10)
Hm, though maybe my example is too specific (it's not even using Processing, but directly jogamp). So @Empyreans were you able to build a fat jar at the end? And run processing/quil with it?
Just a quick update. I did not build a fat jar manually, but I've used the jogamp-fatjar from the official repository here: https://jogamp.org/deployment/v2.4.0/fat/ the stable version of 2.4.0 was officially released on the first of february btw, and I think you can also find the sources for everything in there :)
So first I installed the artifact to the local repository like this: mvn install:install-file -Dfile=[...]/jogamp-fat.jar -DgroupId=quil -DartifactId=jogamp-fat -Dversion=2.4.0 -Dpackaging=jar -DgeneratePom=true
Then I referenced the new artifact in pom.xml of your provided test
<dependency>
<groupId>quil</groupId>
<artifactId>jogamp-fat</artifactId>
<version>2.4.0</version>
</dependency>
that works just as fine as the 2.3.2 versions of gluegen and jogl from the quil clojars.
Now to quil. First I need to reference that artifact in the quil project.clj [quil/jogamp-fat "2.4.0"]
of course and install that.
With this setup, I can use the regular rendered just fine. However, when trying p2d rendered, it fails on my setup. Here is the stacktrace:
2. Unhandled clojure.lang.Compiler$CompilerException
Error compiling main.clj at (98:1)
#:clojure.error{:phase :execution, :line 98, :column 1, :source "main.clj"}
Compiler.java: 3719 clojure.lang.Compiler$InvokeExpr/eval
Compiler.java: 457 clojure.lang.Compiler$DefExpr/eval
Compiler.java: 7199 clojure.lang.Compiler/eval
Compiler.java: 7653 clojure.lang.Compiler/load
REPL: 1 user/eval7291
REPL: 1 user/eval7291
Compiler.java: 7194 clojure.lang.Compiler/eval
Compiler.java: 7149 clojure.lang.Compiler/eval
core.clj: 3215 clojure.core/eval
core.clj: 3211 clojure.core/eval
interruptible_eval.clj: 87 nrepl.middleware.interruptible-eval/evaluate/fn/fn
AFn.java: 152 clojure.lang.AFn/applyToHelper
AFn.java: 144 clojure.lang.AFn/applyTo
core.clj: 667 clojure.core/apply
core.clj: 1990 clojure.core/with-bindings*
core.clj: 1990 clojure.core/with-bindings*
RestFn.java: 425 clojure.lang.RestFn/invoke
interruptible_eval.clj: 87 nrepl.middleware.interruptible-eval/evaluate/fn
main.clj: 437 clojure.main/repl/read-eval-print/fn
main.clj: 437 clojure.main/repl/read-eval-print
main.clj: 458 clojure.main/repl/fn
main.clj: 458 clojure.main/repl
main.clj: 368 clojure.main/repl
RestFn.java: 1523 clojure.lang.RestFn/invoke
interruptible_eval.clj: 84 nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 56 nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 152 nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
AFn.java: 22 clojure.lang.AFn/run
session.clj: 218 nrepl.middleware.session/session-exec/main-loop/fn
session.clj: 217 nrepl.middleware.session/session-exec/main-loop
AFn.java: 22 clojure.lang.AFn/run
Thread.java: 833 java.lang.Thread/run
1. Caused by com.jogamp.opengl.GLException
nREPL-session-3b21cfbc-f68e-4442-84ef-95b2c83c738d: createImpl ARB n/a but
required, profile > GL2 requested (OpenGL >= 3.1). Requested:
GLProfile[GL3/GL3.hw], current: 1.4 (Compat profile, compat[], FBO, hardware)
- 1.4 (4.6.0 NVIDIA 516.94)
X11GLXContext.java: 440 jogamp.opengl.x11.glx.X11GLXContext/createImpl
GLContextImpl.java: 793 jogamp.opengl.GLContextImpl/makeCurrentWithinLock
GLContextImpl.java: 676 jogamp.opengl.GLContextImpl/makeCurrent
GLContextImpl.java: 614 jogamp.opengl.GLContextImpl/makeCurrent
GLDrawableHelper.java: 1279 jogamp.opengl.GLDrawableHelper/invokeGLImpl
GLDrawableHelper.java: 1147 jogamp.opengl.GLDrawableHelper/invokeGL
GLAutoDrawableBase.java: 467 jogamp.opengl.GLAutoDrawableBase/defaultDisplay
GLAutoDrawableDelegate.java: 190 com.jogamp.opengl.GLAutoDrawableDelegate/display
PSurfaceJOGL.java: 271 processing.opengl.PSurfaceJOGL/initGL
PSurfaceJOGL.java: 150 processing.opengl.PSurfaceJOGL/initFrame
PApplet.java:10248 processing.core.PApplet/initSurface
PApplet.java:10154 processing.core.PApplet/runSketch
applet.clj: 81 quil.applet/applet-run
applet.clj: 78 quil.applet/applet-run
applet.clj: 329 quil.applet/applet
applet.clj: 269 quil.applet/applet
RestFn.java: 137 clojure.lang.RestFn/applyTo
Compiler.java: 3714 clojure.lang.Compiler$InvokeExpr/eval
Compiler.java: 457 clojure.lang.Compiler$DefExpr/eval
Compiler.java: 7199 clojure.lang.Compiler/eval
Compiler.java: 7653 clojure.lang.Compiler/load
REPL: 1 user/eval7291
REPL: 1 user/eval7291
Compiler.java: 7194 clojure.lang.Compiler/eval
Compiler.java: 7149 clojure.lang.Compiler/eval
core.clj: 3215 clojure.core/eval
core.clj: 3211 clojure.core/eval
interruptible_eval.clj: 87 nrepl.middleware.interruptible-eval/evaluate/fn/fn
AFn.java: 152 clojure.lang.AFn/applyToHelper
AFn.java: 144 clojure.lang.AFn/applyTo
core.clj: 667 clojure.core/apply
core.clj: 1990 clojure.core/with-bindings*
core.clj: 1990 clojure.core/with-bindings*
RestFn.java: 425 clojure.lang.RestFn/invoke
interruptible_eval.clj: 87 nrepl.middleware.interruptible-eval/evaluate/fn
main.clj: 437 clojure.main/repl/read-eval-print/fn
main.clj: 437 clojure.main/repl/read-eval-print
main.clj: 458 clojure.main/repl/fn
main.clj: 458 clojure.main/repl
main.clj: 368 clojure.main/repl
RestFn.java: 1523 clojure.lang.RestFn/invoke
interruptible_eval.clj: 84 nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 56 nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 152 nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
AFn.java: 22 clojure.lang.AFn/run
session.clj: 218 nrepl.middleware.session/session-exec/main-loop/fn
session.clj: 217 nrepl.middleware.session/session-exec/main-loop
AFn.java: 22 clojure.lang.AFn/run
Thread.java: 833 java.lang.Thread/run
My setup is non-standard though. I use WSL2 from Windows 10 to use Clojure and Quil on Ubuntu 22.04 running inside of Emacs in a REPL... ;) So maybe you can try it real native on your system instead, so we can rule out my setup as the source of failure.
Okay I tried it with an old linux laptop of mine and it ... worked? So I could use the p2d renderer! Can you please confirm that this works for you too :)
In the end I could run processing 4.1.2 with joglamp-fat 2.4.0 and did pass all tests with lein test
on linux-amd64 with jdk17 without changing anything else!
I'll prepare a PR.
This has been released with v4.3.1323 targeting Processing 4.3. The released, fat jar contains all of the architecture specific binaries, so it works for OSX M1, aarch64, amd64 architectures on Java 17+.
At some point we should resume releasing our own copy of the processing jars, as currently they are just bundled in the fat jar for release, which means the POMs don't technically report all of their dependencies correctly on clojars. Regardless, the release should work on everyone's machine if they are running Java 17+.
Hi,
This is related to several other issues that stem from the fact that Processing 3.X.X supports only Java 8.
There has been an effort in the Processing community to support Java 9+, which turned out not to be possible without some breaking changes, so they finally initiated Processing 4, which got the first alpha1 release in January 2020, and is currently in alpha2 stage. https://github.com/processing/processing4/releases
Is there any plan to move quil to Processing 4?
Most of Clojure community seems to use Java 11+, and those who use Java 8 mainly do this in production. I assume that more people use quil for desktop related work, experiments, etc. rather than in server-side production code.