ClojureScript de Jong Attractor
github.comAuthor here! I experimented a bunch with different ways to calculate the plotted points. WebGL shaders outperformed everything by a mile, though it was weird dropping down into what's essentially a low level C-like language. Check it out https://github.com/cjlarose/de-jong/blob/master/src/de_jong/...
Obviously I'm showing my lack of knowledge here. I really only know enough about Open GL to look stupid on the internet ;-)
I've often wondered, though, how hard it would be to write a lisp compiler that outputted ARB, rather than use GLSL for coding shaders. Is this possible?
I may be completely wrong, but my gut feeling is that shader coding seems like it would be a natural fit for functional languages.
I think there have been a few efforts to do such a thing. A quick search of github and I found https://github.com/kovasb/gamma/blob/master/README.md
I stumbled upon gamma when I first starting looking into shaders--it's pretty incredible what it's doing. mikekchar is exactly right, I think, in thinking that lisp is a good candidate for creating what's described as embedded domain-specific languages (EDSLs). When I first explored writing my own shader for this project, I opted for doing it myself just so I could get a better understanding of what's happening under the covers, with the intention of maybe introducing gamma later. It ended up that my shader was super simple--just a for loop and some basic trig math, so it wasn't super necessary to migrate. But, from what I've heard, even mildly complex shaders can get out of hand quickly, so gamma and projects like it are super promising.
Oh weird! Is it common in ClojureScript to pass strings of code around like this?
Most things that deal with GLSL have to upload the code to the driver for compiling and execution, so you'll see it most places as it stands now, or there may be a loader function that reads external files, but ultimately a string of source code is passed.
My favorite is the cube: http://goo.gl/qnDIFW
Make sure to check out the perfectly circular ones, too! http://goo.gl/zilq50
Destroyed my back button.
This cjlarose guy sure is talented!