My modifications to Romain Marucchi-Foino's code from the book "Game and Graphics Programming for iOS and Android with OpenGL ES 2.0"