O'Reilly logo

OpenGL ES 2 for Android by Kevin Brothaler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exercises

Here are some exercises to let you explore these concepts in some more depth and detail:

  • Move the directional lighting calculations out of the shader and store the results in the height map vertex buffer as a single additional float per vertex, so that we only have to calculate this once.

  • Adjust the lighting to make it dynamic. One way you can do this is by turning the particle shooters on and off and then adjusting the brightness of each shooter based on how many particles are still above the ground. If you’re feeling particularly creative, you can even time this to a beat.

  • Move the lighting calculations into the fragment shader so that the lighting is calculated for each fragment rather than for each vertex. When you pass your data ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required