Exercises
We covered quite a few new features in this chapter, so let’s take the time to explore them in more detail:
-
Read up about glCullFace and glFrontFace. Then, as an experiment, add a call to glFrontFace(GL_CW) in onSurfaceCreated.
-
Change the terrain fragment shader to render the terrain with the fragment depth as the color (Hint: You can use gl_FragCoord.z to get the current depth value in a range from 0 to 1; don’t forget that this value is nonlinear).
-
Add a texture to the height map. To make things more interesting, blend between two different textures, depending on the height.
-
Once you have that working, add a flat plane of water to cover up the bottom.
-
Change the height map implementation to use triangle strips and to degenerate triangles ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access