Making the Starfield app
Armed with our newfound knowledge of GLSL, let's build a starfield screensaver, that is, a non-interactive demonstration of stars fleeing from the center of the screen to its sides, under the influence of an imaginary centrifugal force or something.
Tip
As dynamic visual effects are hard to describe unequivocally and screenshots aren't very helpful in this regard either, run the code that accompanies the chapter to get a better idea of what's going on.
Conceptually, each star goes through the same action sequence:
It spawns randomly near the center of the screen.
The star moves in the opposite direction from the screen center until it's no longer visible.
Then it respawns, going back to square one.
We will also make stars accelerate and grow in size as they approach the edges of the screen to simulate the faux depth.
The following screenshot attempts (or, to be more specific, fails due to the highly dynamic nature of the demo) to illustrate what the end result will look...