Friday 19 April 2013

ClojureScript & WebGL

A week ago I went to Hack the Tower, a JVM language hackathon (mostly Java/Scala/Clojure). Working with David, our agenda was to try to get a simple WebGL hello-world to work from ClojureScript.

For this I had previously found some example code written by Vishvajit Singh of the Los Angeles Clojure Users Group. We managed to make the code compile and work with modern versions of Leiningen etc. You can find the code on my GitHub and see it in action here.

Looking at the code, what I'd like to do next is to simplify things a bit and see how much of a hassle it would be to get rid of PhiloGL and instead implement that stuff in ClojureScript myself. (No offence to PhiloGL - it's great, but I'm not sure that using JavaScript libraries from ClojureScript is the most elegant way of doing things.)

Another simple thing would be to add a textbox that takes a URL pointing to an image file and then uses that image file as the texture. Or why not even take a URL pointing to a 3D object file, say a .3DS or a Blender file, and then render that. The possibilities are endless. And while I'm dreaming, how about adding sound - how would one go about doing that?

WebGL is awesome, need to explore it a bit more when I have time.