Josh Stone, Blog

Josh’s projects and security nerdery

OpenGL Visualization Progress

I have been very impressed with the recent incarnations of ruby-opengl. I am an extreme OpenGL newb, but my plan was to wait to teach myself more until the Ruby bindings were more mature (where mature is defined to mean compiling on my system and the examples running).

So, I have a project going in my spare time that’s sorta’ work-related. I want to visualize some traffic patterns where flows come in from all over the world. When I started playing around with these OpenGL bindings, I realized that I could probably actually do it!

So far, my proof-of-concept (meaning, the “engine” is prototyped and none of the “real” code is written) is about 300 lines of code. For the first time, I think I finally grasped coordinates and the whole glTranslate/glRotate thing. Making the arcs between points on the map was especially cool – just translate to the center-point and rotate appropriately, then draw the dash-marks at the radius point and rotate the coordinate space around 180 degrees. I was really tickled when I realized it was going to be that elegant (easier than mapping x2 + y2 = r2 to some relative coordinate-space).

As fast as this is (I’m getting a smooth framerate when it’s not full screen), I’m thinking about playing with some Common Lisp bindings (or maybe Scheme), since that should give me another order of magnitude of performance or so.