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

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 ...

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