Since I just got my first Android phone (an HTC Eris while I wait for my HTC Incredible to be shipped)
and I read about the Android NDK as well as OpenGL ES support it seemed like a good idea to write a simple particle system in C as practice for my Blender OpenCL Particle project. For some reason I also find it plain cool to write in C on a phone with such a nice SDK and support system.
I’ve uploaded my code in hopes that others trying to get into C development with OpenGL may benefit from this example. I based the Java part off the san-angeles demo in the NDK and added more touch interaction, dragging rotates the scene and touching moves the emitter of the particles. The system is pretty simple right now and I still need to get more familiar with OpenGL. I’m looking forward to trying OpenGL ES 2.0 but I need to wait for my Incredible since the Eris doesn’t support it.
This was a fun exercise and it feels good to get some fairly low level control over my phone. I need to focus more on the OpenCL acceleration of particle system’s on bigger GPUs, but luckily almost all of the C code could be copy pasted into a GLUT project and run on a PC. There are some interesting differences that need to be considered like the lack of floating point support in most Android hardware. As a hobby I’m going to explore more interesting effects on the phone, and for work I’m going to add timing/profiling and keep the code modular so I can measure performance on many different platforms (now including phones!).
Hmm… what if we ported the Blender Game Engine to Android with the NDK? I hear they have Bullet Physics already… ok I’m getting ahead of myself!