Saturday, April 9, 2011

Start porting some of OpenGL SuperBible classes to clojure

My hard copy book of The Joy of Clojure finally came in, and I feel reinvigorated to start programming in my spare time.  As I've been reading the SuperBible book, I realize that it is very much geared towards using its built in classes.  For example, it uses a GLShaderManager class to handle a lot of the shader programs, and it has its own library that deals with a lot of the math basics.

Since I want to do this in clojure, I'm going to have to port or at least heavily borrow from these C++ classes in order to use them.  It's also been about 2 months since I've touched any clojure code, and it's already gotten quite rusty.  For example, while reading through the Joy of Clojure book, I already forgot the differences between map, apply and reduce.  So I hopefully porting the C++ classes to clojure will be a good way to refreshen my clojure.

I'm still not sure what the best way to do this will be.  On one hand, it might be better to port it to Java first, and then make clojure wrappers around it.  If I do that, more people will be able to benefit from it, and I could also in theory use jython or Scala with it if I wanted (not that I know Scala that well).  On the other hand, I think that will not only be more work, there might be stuff lost in translation.  Just like how the Bible got corrupted by going from Aramaic to Latin to English, so too I think would going from C++ to Java to clojure.  That being said, I'll have to deal with Java at some level since I will be using lwjgl as my interface to OpenGL.

So starting today, I'll start work on this port in my sojourner project.  Which by the way, I've totally forgotten how to use leiningen with.  I started looking at cake, but its Windows support seems to be a little iffy, even though I dislike Windows.  Speaking of which, I might also throw Chakra on my main desktop, as its a more user-friendly version of Arch linux.  My other option is throwing Sabayon.  I really want to use a rolling-release style of linux rather than point release versions since upgrading almost inevitably winds up breaking something pretty badly.

No comments:

Post a Comment