« JOGL -> Java OpenGL | Main | Shifting gears to Ruby »
February 17, 2005
OpenGL explorations
OpenGL is turning out to be quite fun! I haven't tried any of GLUT's features out yet, but I've got a simple java app now that draws a cartesian coordinate system on a canvas, along with a light grey background grid. I've found a few bugs/typos in the example code from the book I'm reading, so those were fun to find and fix. I think I'm going to need to get an additional reference book that covers OpenGL in general, since there are a lot of shapes and drawing methods to keep track of.
Skimming forward, I can see I'm going to be learning about defining wireframes, laying textures on them, and positioning and configuring lights to apply shadows. One big thing I've been itching to do with OpenGL is 3d rendering of audio samples to show how the frequency spectrum of an audio clip varies over time. When thinking about the x/y/z rendering, I realized that I have another dimension of data available to me, namely the color of pixels in the Z axis. I could apply a color gradient from dark to light that rises from the floor of the graph to the peaks, making it easier to spot outliers from the average data.
I've downloaded some JOGL examples and tried them out, they were doing some tough number crunching. One of them was a large textured logo with realtime waves and shadows applied to its surface. Just to make sure JOGL was working okay, I booted up OS X's Open GL Profiler app. This app is going to be my bread and butter over the coming weeks. It lets you attach to a process and sample its OpenGL calls to see what frame rate it's using, and you can even grab a trace of calls over a period of time, and then see the raw api calls in a window, kind of like how a debugger can show you disassembled asm code for a C function. The freaky thing is that you can attach the OpenGL Profiler to any app running, so you can peek at games running on your mac and see how they implement their 3d rendering.
I think I'm going to need to make a future entry discussing OS X's terrific developer tools. Most people are aware of Xcode and Interface Builder, but there's much more stuff available. Now, developing apps on OS X isn't painless yet, and it's still a little difficult to port unix apps over, but when you look at the platform and include all of the great tools for developers, it just might be the ultimate platform for software development, beating out Windows, Linux, BSD, BeOS, etc, etc. I'll share my thoughts on what tools I find useful in a future entry.
Posted by djb at February 17, 2005 02:15 PM