Getting ready

Set up your OpenGL application to render a flat, tessellated surface in the x-z plane. The results will look better if you use a large number of triangles. Also, keep track of the animation time using whatever method you prefer. Provide the current time to the vertex shader via the uniform Time variable.

The other important uniform variables are the coefficients of the previous wave equation:

  • K: It is the wavenumber (2π/λ)
  • Velocity: It is the wave's velocity
  • Amp: It is the wave's amplitude

Set up your program to provide appropriate uniform variables for your chosen shading model.

Get OpenGL 4 Shading Language Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.