Metaballs, a spring and the iPhone

Goals

The main goals of this project were to experiment with at least one dynamics system, use metaballs and look at how OpenGL works on the iPhone.

Project

The project runs on the iPhone and in the iPhone simulator. In the current iteration, four metaballs oscillate around each other, creating a blob. When the user touches the screen they can "stretch" the blob. When they lift their finger off the screen the blob snaps back into place using spring dynamics

Challenges

Metaballs seem very tricky to render in realtime with any sort of efficiency. It becomes especially difficult if you don't set a binary threshold value for rendering the pixels of the metaballs, as then you must render every pixel in the scene. Setting a threshold would allow you to optimize the area that is rendered but would remove the glow effect the metaballs currently have.

The iPhone OpenGL stack doesn't come with GL utilities. In order to translate screen presses into OpenGL coordinates I had to find and port gluUnProject to the iPhone. You can find this code in the download.

Video

Helpful Links