cube2

A spinning 3D cube showing a JPEG on each face.

The 3D parts of this demo are the same as in the cobra demo. It's a little bit of math to turn the screen touches into 3D rotations.

The drawing is done in the function quad, which draws a single face using the current bitmap. It takes the (x,y) coordinates of the four corners, and stretches the current bitmap to fit the quad.

It easily runs at 60 Hz on a standard Arduino.