In this posting I will again be using WebGL.  However as opposed to just drawing a triangle and doing a gradient fill, which you can see here.  Gradient Triangle.

The code listed below will use WebGL to draw a cube and make it rotate.

WebGL Rotating a Cube