I first started programming PewPew on Linux, with portable librairies (OpenGL/SDL/libcurl). Of course, I had the iPhone/iPod touch in mind, so I designed the gameplay and the UI accordingly.
After a month or two (once I payed for the $99 for the SDK), I migrated to Xcode and the iPhone OS. I'll write a post about that later because it was not as simple as I imagined it would be.
A week ago, I migrated the code back to Linux, and this time it only took a couple of days :) The goal was to make PewPew prettier by giving the lines a glowing look (like geometry wars) by using the infinite power of my computer (compared to the iphone anyway).
Naturally, at first I failed :-)
My first idea was to draw the lines multiple times, with different width and different transparencies. Here's what it looked like:
Okay so that was ugly, but it had to be done. The second idea was to use pixel shaders. A pixel shader is small routine executed on the graphic card, that is applied to every pixel drawn. In this case, the shader would blur the screen.
And then I remember that activating motion blur in Crysis made the game run at 10fps...
So I got a third idea, where every line drawn would actually be a streched texture. However, a problem would arises when you would look at the line along its axis: you would only see its profil. By searching a bit (actually, a lot) on the internet, I found out that this problem has been solved, and has a name: Volumetric Lines.
I won't go into the detail of the technique, there is some code here. However I will say that his implementation kicks ass, because he actually use the GPU to process the orientation of the texture (using a vertex shader). Here are some glorious screenshots:
This time, the screenshots are made under OS X, and with the iPhone's screen resolution.
Transparency is not yet working, but that should be easy to correct and I think that using mipmapping will reduce the aliasing (and thus make thinner lines possible). Also, the vertex shader has the additional effect of messing up the tab polygon. hehe.
Overall, I am pretty happy of the result. BTW, it might be possible to run this on the iPhone 3GS at a descent frame rate... To be followed?