waves.zip (704 KB)


This example shows how a texture can be used by the vertex shader in order to manipulate the vertex data. This example is very simple and is just a demonstration that the texture functions will work in either shader and that multiple textures can be loaded into the same shader program.

We start with a simple plane which is made up of a large number of vertices. We use one texture to modify the Y coordinate of the vertex data, this is just a black and white gradient image. We also offset the UV values each frame so that it appears to be moving across the plane. Then in our pixel shader the normal colour texture is sampled in order to give the plane colour.