iPod Train Simulator
It’s been too long since I last posted something about my software projects, so I want to give an overview here. First of all, Hubschrauber is going along nicely, although I haven’t done much work on it lately. Instead there’s something different that has no name yet, but just might turn out to be interesting.
It’s a railroad simulator for iPhone and iPod touch. Some basic functionality already works. To do something more interesting, I decided to write a level editor, and that turned out to be trouble.
I’m trying to make all texture editing go via the GPU, but I get incorrect values somewhere. Accessing video RAM that you shouldn’t access is always fun, since you never know whether you get a crash (which might involve the entire computer), some artifacts or, like here, contents of various windows on the screen.
My default solution for this would be to go bug hunting with Apple’s OpenGL Profiler, a free and useful tool for analyzing how your application uses OpenGL and what it does wrong. The problem: It does not work.
Since Mac OS X 10.5 Leopard, the Cocoa development environment supports a garbage collector. This means that I don’t have to think about RAM (normal, not GPU RAM) at all, I just use it and when I’m done someone will notice and take care. That works well and has been the default in other languages for some time already, but all code in a program has to support it. OpenGL-Profiler loads new code into the program to do it’s work, and that code is not GC-compatible, resulting in odd crashes.
If I don’t find the problem soonish, I guess I’ll have to switch the entire level editor back to manual memory management just so I can debug it better. And what did we learn from that? Never use the garbage collector in applications that make any non-trivial use of OpenGL.
Written on April 2nd, 2009 at 10:17 pm